From 2a50dca14951e9f84d583bf376aa742ff5a0d557 Mon Sep 17 00:00:00 2001 From: Yukang Date: Thu, 10 Sep 2026 19:38:04 +0800 Subject: [PATCH 1/2] Add regression tests for non-Send field locations --- ...field-location-issue-146016.current.stderr | 90 +++++++++++++++++++ ...nd-field-location-issue-146016.next.stderr | 90 +++++++++++++++++++ .../non-send-field-location-issue-146016.rs | 62 +++++++++++++ 3 files changed, 242 insertions(+) create mode 100644 tests/ui/traits/non-send-field-location-issue-146016.current.stderr create mode 100644 tests/ui/traits/non-send-field-location-issue-146016.next.stderr create mode 100644 tests/ui/traits/non-send-field-location-issue-146016.rs diff --git a/tests/ui/traits/non-send-field-location-issue-146016.current.stderr b/tests/ui/traits/non-send-field-location-issue-146016.current.stderr new file mode 100644 index 0000000000000..e13180a4f1071 --- /dev/null +++ b/tests/ui/traits/non-send-field-location-issue-146016.current.stderr @@ -0,0 +1,90 @@ +error[E0277]: `*const c_void` cannot be sent between threads safely + --> $DIR/non-send-field-location-issue-146016.rs:41:20 + | +LL | require_send::>(); + | ^^^^^^^^^^^ `*const c_void` cannot be sent between threads safely + | + = help: within `Record<*const c_void>`, the trait `Send` is not implemented for `*const c_void` +note: required because it appears within the type `Record<*const c_void>` + --> $DIR/non-send-field-location-issue-146016.rs:24:8 + | +LL | struct Record { + | ^^^^^^ +note: required by a bound in `require_send` + --> $DIR/non-send-field-location-issue-146016.rs:38:20 + | +LL | fn require_send() {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `*const c_void` cannot be sent between threads safely + --> $DIR/non-send-field-location-issue-146016.rs:43:20 + | +LL | require_send::>(); + | ^^^^^^^^^^^ `*const c_void` cannot be sent between threads safely + | + = help: within `Nested<*const c_void>`, the trait `Send` is not implemented for `*const c_void` +note: required because it appears within the type `Record<*const c_void>` + --> $DIR/non-send-field-location-issue-146016.rs:24:8 + | +LL | struct Record { + | ^^^^^^ +note: required because it appears within the type `Nested<*const c_void>` + --> $DIR/non-send-field-location-issue-146016.rs:29:8 + | +LL | struct Nested { + | ^^^^^^ +note: required by a bound in `require_send` + --> $DIR/non-send-field-location-issue-146016.rs:38:20 + | +LL | fn require_send() {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `*const c_void` cannot be sent between threads safely + --> $DIR/non-send-field-location-issue-146016.rs:45:20 + | +LL | require_send::>(); + | ^^^^^^^^^^^^^ `*const c_void` cannot be sent between threads safely + | + = help: within `Multiple<*const c_void>`, the trait `Send` is not implemented for `*const c_void` +note: required because it appears within the type `Multiple<*const c_void>` + --> $DIR/non-send-field-location-issue-146016.rs:33:6 + | +LL | enum Multiple { + | ^^^^^^^^ +note: required by a bound in `require_send` + --> $DIR/non-send-field-location-issue-146016.rs:38:20 + | +LL | fn require_send() {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `*const c_void` cannot be sent between threads safely + --> $DIR/non-send-field-location-issue-146016.rs:55:27 + | +LL | let h = thread::spawn(move || match rx.recv().unwrap() { + | _____________-------------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | Foo::Case(x) => println!("{:?}", x), +LL | | Foo::Case2(b) => println!("{:?}", b), +LL | | }); + | |_____^ `*const c_void` cannot be sent between threads safely + | + = help: within `Foo`, the trait `Send` is not implemented for `*const c_void` +note: required because it appears within the type `Foo` + --> $DIR/non-send-field-location-issue-146016.rs:19:6 + | +LL | enum Foo { + | ^^^ + = note: required for `std::sync::mpsc::Receiver` to implement `Send` +note: required because `rx` is used within this closure + --> $DIR/non-send-field-location-issue-146016.rs:55:41 + | +LL | let h = thread::spawn(move || match rx.recv().unwrap() { + | ^^ +note: required by a bound in `spawn` + --> $SRC_DIR/std/src/thread/functions.rs:LL:COL + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non-send-field-location-issue-146016.next.stderr b/tests/ui/traits/non-send-field-location-issue-146016.next.stderr new file mode 100644 index 0000000000000..e13180a4f1071 --- /dev/null +++ b/tests/ui/traits/non-send-field-location-issue-146016.next.stderr @@ -0,0 +1,90 @@ +error[E0277]: `*const c_void` cannot be sent between threads safely + --> $DIR/non-send-field-location-issue-146016.rs:41:20 + | +LL | require_send::>(); + | ^^^^^^^^^^^ `*const c_void` cannot be sent between threads safely + | + = help: within `Record<*const c_void>`, the trait `Send` is not implemented for `*const c_void` +note: required because it appears within the type `Record<*const c_void>` + --> $DIR/non-send-field-location-issue-146016.rs:24:8 + | +LL | struct Record { + | ^^^^^^ +note: required by a bound in `require_send` + --> $DIR/non-send-field-location-issue-146016.rs:38:20 + | +LL | fn require_send() {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `*const c_void` cannot be sent between threads safely + --> $DIR/non-send-field-location-issue-146016.rs:43:20 + | +LL | require_send::>(); + | ^^^^^^^^^^^ `*const c_void` cannot be sent between threads safely + | + = help: within `Nested<*const c_void>`, the trait `Send` is not implemented for `*const c_void` +note: required because it appears within the type `Record<*const c_void>` + --> $DIR/non-send-field-location-issue-146016.rs:24:8 + | +LL | struct Record { + | ^^^^^^ +note: required because it appears within the type `Nested<*const c_void>` + --> $DIR/non-send-field-location-issue-146016.rs:29:8 + | +LL | struct Nested { + | ^^^^^^ +note: required by a bound in `require_send` + --> $DIR/non-send-field-location-issue-146016.rs:38:20 + | +LL | fn require_send() {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `*const c_void` cannot be sent between threads safely + --> $DIR/non-send-field-location-issue-146016.rs:45:20 + | +LL | require_send::>(); + | ^^^^^^^^^^^^^ `*const c_void` cannot be sent between threads safely + | + = help: within `Multiple<*const c_void>`, the trait `Send` is not implemented for `*const c_void` +note: required because it appears within the type `Multiple<*const c_void>` + --> $DIR/non-send-field-location-issue-146016.rs:33:6 + | +LL | enum Multiple { + | ^^^^^^^^ +note: required by a bound in `require_send` + --> $DIR/non-send-field-location-issue-146016.rs:38:20 + | +LL | fn require_send() {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `*const c_void` cannot be sent between threads safely + --> $DIR/non-send-field-location-issue-146016.rs:55:27 + | +LL | let h = thread::spawn(move || match rx.recv().unwrap() { + | _____________-------------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | Foo::Case(x) => println!("{:?}", x), +LL | | Foo::Case2(b) => println!("{:?}", b), +LL | | }); + | |_____^ `*const c_void` cannot be sent between threads safely + | + = help: within `Foo`, the trait `Send` is not implemented for `*const c_void` +note: required because it appears within the type `Foo` + --> $DIR/non-send-field-location-issue-146016.rs:19:6 + | +LL | enum Foo { + | ^^^ + = note: required for `std::sync::mpsc::Receiver` to implement `Send` +note: required because `rx` is used within this closure + --> $DIR/non-send-field-location-issue-146016.rs:55:41 + | +LL | let h = thread::spawn(move || match rx.recv().unwrap() { + | ^^ +note: required by a bound in `spawn` + --> $SRC_DIR/std/src/thread/functions.rs:LL:COL + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non-send-field-location-issue-146016.rs b/tests/ui/traits/non-send-field-location-issue-146016.rs new file mode 100644 index 0000000000000..9f9cd6a20e48b --- /dev/null +++ b/tests/ui/traits/non-send-field-location-issue-146016.rs @@ -0,0 +1,62 @@ +//@ revisions: current next +//@ [next] compile-flags: -Znext-solver +//@ edition: 2024 + +//! Regression test for https://github.com/rust-lang/rust/issues/146016. +//! Locate the field that introduces an auto-trait requirement, even through a type alias. + +use std::sync::mpsc; +use std::thread; + +mod other { + use std::ffi::c_void; + + pub type Bar = *const c_void; +} + +use other::Bar; + +enum Foo { + Case(i32), + Case2(Bar), +} + +struct Record { + unrelated: u8, + value: T, +} + +struct Nested { + value: Record, +} + +enum Multiple { + Empty, + Values { first: T, second: T }, +} + +fn require_send() {} + +fn generic_fields() { + require_send::>(); + //~^ ERROR `*const c_void` cannot be sent between threads safely + require_send::>(); + //~^ ERROR `*const c_void` cannot be sent between threads safely + require_send::>(); + //~^ ERROR `*const c_void` cannot be sent between threads safely + + require_send::>(); + require_send::>(); + require_send::>(); +} + +fn main() { + let (tx, rx) = mpsc::channel(); + let h = thread::spawn(move || match rx.recv().unwrap() { + //~^ ERROR `*const c_void` cannot be sent between threads safely + Foo::Case(x) => println!("{:?}", x), + Foo::Case2(b) => println!("{:?}", b), + }); + tx.send(Foo::Case2(std::ptr::null())); + h.join(); +} From f69eeb67cf5c7a138b6d0a007064e9b9d1cc87f3 Mon Sep 17 00:00:00 2001 From: Yukang Date: Sun, 20 Sep 2026 16:17:20 +0800 Subject: [PATCH 2/2] Point to fields that introduce trait requirements --- .../src/error_reporting/traits/suggestions.rs | 20 ++++++++++++-- tests/ui/associated-consts/issue-58022.stderr | 2 +- .../issue-70935-complex-spans.stderr | 2 +- .../issue-72590-type-error-sized.stderr | 3 +++ .../async-await/pin-needed-to-poll-2.stderr | 2 +- .../auto-trait-phantom-data-bounds.stderr | 6 ++++- .../builtin-superkinds-in-metadata.stderr | 2 +- tests/ui/coherence/deep-bad-copy-reason.rs | 1 + .../ui/coherence/deep-bad-copy-reason.stderr | 11 +++++--- tests/ui/deref/pin-impl-deref.stderr | 4 +-- tests/ui/did_you_mean/recursion_limit.stderr | 27 +++++++++++++++++++ tests/ui/dst/dst-bad-deep-2.stderr | 2 +- tests/ui/dst/dst-bad-deep.stderr | 2 ++ tests/ui/error-codes/E0277-2.stderr | 6 +++++ tests/ui/extern/extern-types-unsized.stderr | 9 +++++++ .../feature-gate-offset-of-slice.stderr | 3 +++ .../feature-gate-trivial_bounds.stderr | 2 ++ tests/ui/mut/mutable-enum-indirect.stderr | 2 +- tests/ui/offset-of/offset-of-dst-field.stderr | 3 +++ tests/ui/pin-ergonomics/pin-pattern.stderr | 2 +- .../recursion/recursive-requirements.stderr | 7 +++++ tests/ui/sized-hierarchy/impls.stderr | 18 ++++++++----- tests/ui/statics/unsized_type2.stderr | 4 +++ .../unsizing-wfcheck-issue-127299.stderr | 2 ++ tests/ui/suggestions/suggest-pin-macro.stderr | 2 ++ .../ui/threads-sendsync/rc-is-not-send.stderr | 4 ++- ...-level-send-bound-check-issue-40827.stderr | 8 ++++-- tests/ui/traits/cycle-cache-err-60010.stderr | 4 +++ .../ui/traits/enum-negative-send-impl.stderr | 2 ++ .../ui/traits/enum-negative-sync-impl.stderr | 2 ++ tests/ui/traits/issue-7013.stderr | 2 ++ .../negated-auto-traits-error.stderr | 2 +- ...field-location-issue-146016.current.stderr | 16 +++++++++++ ...nd-field-location-issue-146016.next.stderr | 16 +++++++++++ .../opaque-trait-size-error-5883.stderr | 2 ++ tests/ui/traits/suggest-where-clause.stderr | 2 +- .../trivial-unsized-projection-2.bad.stderr | 4 +-- ...rivial-unsized-projection-2.bad_new.stderr | 2 +- ...ck-default-trait-impl-negation-sync.stderr | 4 +++ .../typeck/typeck-unsafe-always-share.stderr | 2 ++ .../issue-50940-with-feature.stderr | 2 +- tests/ui/unsized-locals/unsized-exprs.stderr | 4 +-- tests/ui/unsized/unsized-enum2.stderr | 8 +++--- tests/ui/unsized/unsized-struct.stderr | 2 +- tests/ui/unsized/unsized3.stderr | 8 ++++++ tests/ui/wf/let-pat-inferred-non-wf.stderr | 2 +- 46 files changed, 203 insertions(+), 39 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 8de0514b9ef27..edfb203042cbe 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -4449,11 +4449,27 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { format!("required because it appears within the type `{ty_str}`") }; match *ty.kind() { - ty::Adt(def, _) => { + ty::Adt(def, args) => { let msg = msg(); match tcx.opt_item_ident(def.did()) { Some(ident) => { - err.span_note(ident.span, msg); + let mut spans = MultiSpan::from(ident.span); + if def.did().is_local() + && let Some(pred) = predicate.as_trait_clause() + { + let field_ty = self.deeply_resolve_ignoring_regions( + pred.skip_binder().self_ty(), + ); + for field in def.all_fields() { + if field.ty(tcx, args).skip_norm_wip() == field_ty { + spans.push_span_label( + tcx.def_span(field.did), + "required by this field", + ); + } + } + } + err.span_note(spans, msg); } None => { err.note(msg); diff --git a/tests/ui/associated-consts/issue-58022.stderr b/tests/ui/associated-consts/issue-58022.stderr index 24cec6e141bea..2ef3083d0e925 100644 --- a/tests/ui/associated-consts/issue-58022.stderr +++ b/tests/ui/associated-consts/issue-58022.stderr @@ -9,7 +9,7 @@ note: required because it appears within the type `Bar<[u8]>` --> $DIR/issue-58022.rs:8:12 | LL | pub struct Bar(T); - | ^^^ + | ^^^ - required by this field = note: the return type of a function must have a statically known size error[E0790]: cannot refer to the associated constant on trait without specifying the corresponding `impl` type diff --git a/tests/ui/async-await/issue-70935-complex-spans.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr index b9180c620b0dc..9f8f1461bd309 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.stderr +++ b/tests/ui/async-await/issue-70935-complex-spans.stderr @@ -11,7 +11,7 @@ note: required because it appears within the type `NotSync` --> $DIR/issue-70935-complex-spans.rs:9:8 | LL | struct NotSync(PhantomData<*mut ()>); - | ^^^^^^^ + | ^^^^^^^ -------------------- required by this field = note: required for `&NotSync` to implement `Send` note: required because it's used within this closure --> $DIR/issue-70935-complex-spans.rs:18:13 diff --git a/tests/ui/async-await/issue-72590-type-error-sized.stderr b/tests/ui/async-await/issue-72590-type-error-sized.stderr index 1d030278fd64e..70f615f03186e 100644 --- a/tests/ui/async-await/issue-72590-type-error-sized.stderr +++ b/tests/ui/async-await/issue-72590-type-error-sized.stderr @@ -22,6 +22,9 @@ note: required because it appears within the type `Foo` | LL | struct Foo { | ^^^ +LL | foo: Nonexistent, +LL | other: str + | ---------- required by this field = help: unsized fn params are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | diff --git a/tests/ui/async-await/pin-needed-to-poll-2.stderr b/tests/ui/async-await/pin-needed-to-poll-2.stderr index 8eb671531e792..b7ca47ac4dde2 100644 --- a/tests/ui/async-await/pin-needed-to-poll-2.stderr +++ b/tests/ui/async-await/pin-needed-to-poll-2.stderr @@ -12,7 +12,7 @@ note: required because it appears within the type `Sleep` --> $DIR/pin-needed-to-poll-2.rs:8:8 | LL | struct Sleep(std::marker::PhantomPinned); - | ^^^^^ + | ^^^^^ -------------------------- required by this field note: required by a bound in `Pin::::new` --> $SRC_DIR/core/src/pin.rs:LL:COL diff --git a/tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr index 56c2e8ff257b7..c37695411d736 100644 --- a/tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr +++ b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr @@ -18,6 +18,8 @@ note: required because it appears within the type `Guard<'_, T>` | LL | struct Guard<'a, T: 'a> { | ^^^^^ +LL | _marker: PhantomData<&'a T>, + | --------------------------- required by this field note: required by a bound in `is_zen` --> $DIR/auto-trait-phantom-data-bounds.rs:18:14 | @@ -48,11 +50,13 @@ note: required because it appears within the type `Guard<'_, T>` | LL | struct Guard<'a, T: 'a> { | ^^^^^ +LL | _marker: PhantomData<&'a T>, + | --------------------------- required by this field note: required because it appears within the type `Nested>` --> $DIR/auto-trait-phantom-data-bounds.rs:16:8 | LL | struct Nested(T); - | ^^^^^^ + | ^^^^^^ - required by this field note: required by a bound in `is_zen` --> $DIR/auto-trait-phantom-data-bounds.rs:18:14 | diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index 39a04186981f3..ff26f715d158e 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -8,7 +8,7 @@ note: required because it appears within the type `X` --> $DIR/builtin-superkinds-in-metadata.rs:9:8 | LL | struct X(T); - | ^ + | ^ - required by this field note: required by a bound in `RequiresRequiresShareAndSend` --> $DIR/auxiliary/trait_superkinds_in_metadata.rs:7:58 | diff --git a/tests/ui/coherence/deep-bad-copy-reason.rs b/tests/ui/coherence/deep-bad-copy-reason.rs index f1c2698bad5cc..d93a46f1fcb1a 100644 --- a/tests/ui/coherence/deep-bad-copy-reason.rs +++ b/tests/ui/coherence/deep-bad-copy-reason.rs @@ -9,6 +9,7 @@ pub struct ListS { len: usize, data: [T; 0], opaque: OpaqueListContents, + //~^ NOTE required by this field } pub struct Interned<'a, T>(&'a T); diff --git a/tests/ui/coherence/deep-bad-copy-reason.stderr b/tests/ui/coherence/deep-bad-copy-reason.stderr index 534f26c39c2d4..198ea1d75e388 100644 --- a/tests/ui/coherence/deep-bad-copy-reason.stderr +++ b/tests/ui/coherence/deep-bad-copy-reason.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` cannot be implemented for this type - --> $DIR/deep-bad-copy-reason.rs:38:24 + --> $DIR/deep-bad-copy-reason.rs:39:24 | LL | pub struct List<'tcx, T>(Interned<'tcx, ListS>); | ------------------------ this field does not implement `Copy` @@ -8,13 +8,13 @@ LL | impl<'tcx, T> Copy for List<'tcx, T> {} | ^^^^^^^^^^^^^ | note: the `Copy` impl for `Interned<'tcx, ListS>` requires that `OpaqueListContents: Sized` - --> $DIR/deep-bad-copy-reason.rs:26:26 + --> $DIR/deep-bad-copy-reason.rs:27:26 | LL | pub struct List<'tcx, T>(Interned<'tcx, ListS>); | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `OpaqueListContents` cannot be known at compilation time - --> $DIR/deep-bad-copy-reason.rs:26:26 + --> $DIR/deep-bad-copy-reason.rs:27:26 | LL | pub struct List<'tcx, T>(Interned<'tcx, ListS>); | ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -25,8 +25,11 @@ note: required because it appears within the type `ListS` | LL | pub struct ListS { | ^^^^^ +... +LL | opaque: OpaqueListContents, + | -------------------------- required by this field note: required by an implicit `Sized` bound in `Interned` - --> $DIR/deep-bad-copy-reason.rs:14:25 + --> $DIR/deep-bad-copy-reason.rs:15:25 | LL | pub struct Interned<'a, T>(&'a T); | ^ required by the implicit `Sized` requirement on this type parameter in `Interned` diff --git a/tests/ui/deref/pin-impl-deref.stderr b/tests/ui/deref/pin-impl-deref.stderr index 4143d66f42723..5e0e0aa06715b 100644 --- a/tests/ui/deref/pin-impl-deref.stderr +++ b/tests/ui/deref/pin-impl-deref.stderr @@ -44,7 +44,7 @@ note: required because it appears within the type `MyPinType` --> $DIR/pin-impl-deref.rs:15:8 | LL | struct MyPinType(core::marker::PhantomPinned); - | ^^^^^^^^^ + | ^^^^^^^^^ --------------------------- required by this field = note: required for `Pin<&MyPinType>` to implement `DerefMut` note: required by a bound in `impl_deref_mut` --> $DIR/pin-impl-deref.rs:22:27 @@ -66,7 +66,7 @@ note: required because it appears within the type `MyPinType` --> $DIR/pin-impl-deref.rs:15:8 | LL | struct MyPinType(core::marker::PhantomPinned); - | ^^^^^^^^^ + | ^^^^^^^^^ --------------------------- required by this field = note: required for `Pin<&mut MyPinType>` to implement `DerefMut` note: required by a bound in `impl_deref_mut` --> $DIR/pin-impl-deref.rs:22:27 diff --git a/tests/ui/did_you_mean/recursion_limit.stderr b/tests/ui/did_you_mean/recursion_limit.stderr index 2ecee2030b03f..7960efec9957e 100644 --- a/tests/ui/did_you_mean/recursion_limit.stderr +++ b/tests/ui/did_you_mean/recursion_limit.stderr @@ -8,46 +8,73 @@ LL | is_send::(); note: required because it appears within the type `I` --> $DIR/recursion_limit.rs:23:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { I, J } | ^ note: required because it appears within the type `H` --> $DIR/recursion_limit.rs:22:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { H, I } | ^ note: required because it appears within the type `G` --> $DIR/recursion_limit.rs:21:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { G, H } | ^ note: required because it appears within the type `F` --> $DIR/recursion_limit.rs:20:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { F, G } | ^ note: required because it appears within the type `E` --> $DIR/recursion_limit.rs:19:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { E, F } | ^ note: required because it appears within the type `D` --> $DIR/recursion_limit.rs:18:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { D, E } | ^ note: required because it appears within the type `C` --> $DIR/recursion_limit.rs:17:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { C, D } | ^ note: required because it appears within the type `B` --> $DIR/recursion_limit.rs:16:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { B, C } | ^ note: required because it appears within the type `A` --> $DIR/recursion_limit.rs:15:9 | +LL | enum $id { $id($t) } + | -- required by this field +... LL | link! { A, B } | ^ note: required by a bound in `is_send` diff --git a/tests/ui/dst/dst-bad-deep-2.stderr b/tests/ui/dst/dst-bad-deep-2.stderr index de3f71d206fb4..790e6dff9b5ef 100644 --- a/tests/ui/dst/dst-bad-deep-2.stderr +++ b/tests/ui/dst/dst-bad-deep-2.stderr @@ -9,7 +9,7 @@ note: required because it appears within the type `Fat<[isize]>` --> $DIR/dst-bad-deep-2.rs:6:8 | LL | struct Fat(T); - | ^^^ + | ^^^ - required by this field = note: all function arguments must have a statically known size = help: unsized fn params are gated as an unstable feature diff --git a/tests/ui/dst/dst-bad-deep.stderr b/tests/ui/dst/dst-bad-deep.stderr index 1b0f9738ab09a..bf9baa8e7e3c9 100644 --- a/tests/ui/dst/dst-bad-deep.stderr +++ b/tests/ui/dst/dst-bad-deep.stderr @@ -10,6 +10,8 @@ note: required because it appears within the type `Fat<[isize]>` | LL | struct Fat { | ^^^ +LL | ptr: T + | ------ required by this field = note: structs must have a statically known size to be initialized error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0277-2.stderr b/tests/ui/error-codes/E0277-2.stderr index 9a262f7559075..9cf2d5c4fcc65 100644 --- a/tests/ui/error-codes/E0277-2.stderr +++ b/tests/ui/error-codes/E0277-2.stderr @@ -10,16 +10,22 @@ note: required because it appears within the type `Baz` | LL | struct Baz { | ^^^ +LL | x: *const u8 + | ------------ required by this field note: required because it appears within the type `Bar` --> $DIR/E0277-2.rs:5:8 | LL | struct Bar { | ^^^ +LL | baz: Baz + | -------- required by this field note: required because it appears within the type `Foo` --> $DIR/E0277-2.rs:1:8 | LL | struct Foo { | ^^^ +LL | bar: Bar + | -------- required by this field note: required by a bound in `is_send` --> $DIR/E0277-2.rs:13:15 | diff --git a/tests/ui/extern/extern-types-unsized.stderr b/tests/ui/extern/extern-types-unsized.stderr index 6c1d7a7b61b3c..c4c919cd646b4 100644 --- a/tests/ui/extern/extern-types-unsized.stderr +++ b/tests/ui/extern/extern-types-unsized.stderr @@ -27,6 +27,9 @@ note: required because it appears within the type `Foo` | LL | struct Foo { | ^^^ +LL | x: u8, +LL | tail: A, + | ------- required by this field note: required by an implicit `Sized` bound in `assert_sized` --> $DIR/extern-types-unsized.rs:19:17 | @@ -49,6 +52,9 @@ note: required because it appears within the type `Bar` | LL | struct Bar { | ^^^ +LL | x: u8, +LL | tail: T, + | ------- required by this field note: required by an implicit `Sized` bound in `assert_sized` --> $DIR/extern-types-unsized.rs:19:17 | @@ -84,6 +90,9 @@ note: required because it appears within the type `Bar` | LL | struct Bar { | ^^^ +LL | x: u8, +LL | tail: T, + | ------- required by this field note: required by an implicit `Sized` bound in `assert_sized` --> $DIR/extern-types-unsized.rs:19:17 | diff --git a/tests/ui/feature-gates/feature-gate-offset-of-slice.stderr b/tests/ui/feature-gates/feature-gate-offset-of-slice.stderr index 83b0acf88bdb5..4ac4472b78e0e 100644 --- a/tests/ui/feature-gates/feature-gate-offset-of-slice.stderr +++ b/tests/ui/feature-gates/feature-gate-offset-of-slice.stderr @@ -18,6 +18,9 @@ note: required because it appears within the type `S` | LL | struct S { | ^ +... +LL | c: [i32], + | -------- required by this field error[E0277]: the size for values of type `[i32]` cannot be known at compilation time --> $DIR/feature-gate-offset-of-slice.rs:25:5 diff --git a/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr b/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr index e9bee1597c5cd..76695064dec16 100644 --- a/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -141,6 +141,8 @@ note: required because it appears within the type `Dst<(dyn A + 'static)>` | LL | struct Dst { | ^^^ +LL | x: X, + | ---- required by this field help: add `#![feature(trivial_bounds)]` to the crate attributes to enable | LL + #![feature(trivial_bounds)] diff --git a/tests/ui/mut/mutable-enum-indirect.stderr b/tests/ui/mut/mutable-enum-indirect.stderr index b15492357f5c8..40ece8bce9ab5 100644 --- a/tests/ui/mut/mutable-enum-indirect.stderr +++ b/tests/ui/mut/mutable-enum-indirect.stderr @@ -15,7 +15,7 @@ note: required because it appears within the type `Foo` --> $DIR/mutable-enum-indirect.rs:11:6 | LL | enum Foo { A(NoSync) } - | ^^^ + | ^^^ ------ required by this field = note: required because it appears within the type `&Foo` note: required by a bound in `bar` --> $DIR/mutable-enum-indirect.rs:13:11 diff --git a/tests/ui/offset-of/offset-of-dst-field.stderr b/tests/ui/offset-of/offset-of-dst-field.stderr index 77ae34b0872fa..1bceb3c409177 100644 --- a/tests/ui/offset-of/offset-of-dst-field.stderr +++ b/tests/ui/offset-of/offset-of-dst-field.stderr @@ -58,6 +58,9 @@ note: required because it appears within the type `Alpha` | LL | struct Alpha { | ^^^^^ +... +LL | z: [u8], + | ------- required by this field error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/offset-of-dst-field.rs:51:5 diff --git a/tests/ui/pin-ergonomics/pin-pattern.stderr b/tests/ui/pin-ergonomics/pin-pattern.stderr index c0e8b2d40c70f..5262de183e749 100644 --- a/tests/ui/pin-ergonomics/pin-pattern.stderr +++ b/tests/ui/pin-ergonomics/pin-pattern.stderr @@ -36,7 +36,7 @@ note: required because it appears within the type `Foo` --> $DIR/pin-pattern.rs:11:8 | LL | struct Foo(T); - | ^^^ + | ^^^ - required by this field help: consider restricting type parameter `T` with trait `Unpin` | LL | fn tuple_ref_pin_mut_pat_and_mut_of_tuple_pin_mut_ty<'a, T: std::marker::Unpin>( diff --git a/tests/ui/recursion/recursive-requirements.stderr b/tests/ui/recursion/recursive-requirements.stderr index bb63f7cd0dce0..d4197eded7d28 100644 --- a/tests/ui/recursion/recursive-requirements.stderr +++ b/tests/ui/recursion/recursive-requirements.stderr @@ -10,6 +10,8 @@ note: required because it appears within the type `Foo` | LL | pub struct Foo { | ^^^ +LL | bar: *const Bar, + | --------------- required by this field note: required by a bound in `AssertSync` --> $DIR/recursive-requirements.rs:3:22 | @@ -28,6 +30,8 @@ note: required because it appears within the type `Bar` | LL | pub struct Bar { | ^^^ +LL | foo: *const Foo, + | --------------- required by this field note: required because it appears within the type `PhantomData` --> $SRC_DIR/core/src/marker.rs:LL:COL note: required because it appears within the type `Foo` @@ -35,6 +39,9 @@ note: required because it appears within the type `Foo` | LL | pub struct Foo { | ^^^ +LL | bar: *const Bar, +LL | phantom: PhantomData, + | ------------------------- required by this field note: required by a bound in `AssertSync` --> $DIR/recursive-requirements.rs:3:22 | diff --git a/tests/ui/sized-hierarchy/impls.stderr b/tests/ui/sized-hierarchy/impls.stderr index 25c6c933149fd..1e0f234ce19a4 100644 --- a/tests/ui/sized-hierarchy/impls.stderr +++ b/tests/ui/sized-hierarchy/impls.stderr @@ -292,7 +292,9 @@ note: required because it appears within the type `StructAllFieldsMetaSized` --> $DIR/impls.rs:235:12 | LL | struct StructAllFieldsMetaSized { x: [u8], y: [u8] } - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ ------- ------- required by this field + | | + | required by this field note: required by a bound in `needs_sized` --> $DIR/impls.rs:13:19 | @@ -310,7 +312,9 @@ note: required because it appears within the type `StructAllFieldsUnsized` --> $DIR/impls.rs:243:12 | LL | struct StructAllFieldsUnsized { x: Foo, y: Foo } - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ ------ ------ required by this field + | | + | required by this field note: required by a bound in `needs_sized` --> $DIR/impls.rs:13:19 | @@ -328,7 +332,9 @@ note: required because it appears within the type `StructAllFieldsUnsized` --> $DIR/impls.rs:243:12 | LL | struct StructAllFieldsUnsized { x: Foo, y: Foo } - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ ------ ------ required by this field + | | + | required by this field note: required by a bound in `needs_metasized` --> $DIR/impls.rs:16:23 | @@ -346,7 +352,7 @@ note: required because it appears within the type `StructLastFieldMetaSized` --> $DIR/impls.rs:252:12 | LL | struct StructLastFieldMetaSized { x: u32, y: [u8] } - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ ------- required by this field note: required by a bound in `needs_sized` --> $DIR/impls.rs:13:19 | @@ -364,7 +370,7 @@ note: required because it appears within the type `StructLastFieldUnsized` --> $DIR/impls.rs:259:12 | LL | struct StructLastFieldUnsized { x: u32, y: Foo } - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ ------ required by this field note: required by a bound in `needs_sized` --> $DIR/impls.rs:13:19 | @@ -382,7 +388,7 @@ note: required because it appears within the type `StructLastFieldUnsized` --> $DIR/impls.rs:259:12 | LL | struct StructLastFieldUnsized { x: u32, y: Foo } - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ ------ required by this field note: required by a bound in `needs_metasized` --> $DIR/impls.rs:16:23 | diff --git a/tests/ui/statics/unsized_type2.stderr b/tests/ui/statics/unsized_type2.stderr index 293df7554e99f..5bccabf0bc133 100644 --- a/tests/ui/statics/unsized_type2.stderr +++ b/tests/ui/statics/unsized_type2.stderr @@ -10,6 +10,8 @@ note: required because it appears within the type `Foo` | LL | pub struct Foo { | ^^^ +LL | pub version: str, + | ---------------- required by this field = note: statics and constants must have a statically known size error[E0308]: mismatched types @@ -30,6 +32,8 @@ note: required because it appears within the type `Foo` | LL | pub struct Foo { | ^^^ +LL | pub version: str, + | ---------------- required by this field = note: structs must have a statically known size to be initialized error: aborting due to 3 previous errors diff --git a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr index e231d57a26d91..1467de675be56 100644 --- a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr +++ b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr @@ -34,6 +34,8 @@ note: required because it appears within the type `Lint` | LL | pub struct Lint { | ^^^^ +LL | pub desc: &'static dyn Qux, + | -------------------------- required by this field = note: required because it appears within the type `&'static Lint` = note: shared static variables must have a type that implements `Sync` diff --git a/tests/ui/suggestions/suggest-pin-macro.stderr b/tests/ui/suggestions/suggest-pin-macro.stderr index a761a454ad5a3..c1877fae753c8 100644 --- a/tests/ui/suggestions/suggest-pin-macro.stderr +++ b/tests/ui/suggestions/suggest-pin-macro.stderr @@ -11,6 +11,8 @@ note: required because it appears within the type `Test` | LL | struct Test { | ^^^^ +LL | _marker: PhantomPinned, + | ---------------------- required by this field note: required by a bound in `Pin::<&'a mut T>::get_mut` --> $SRC_DIR/core/src/pin.rs:LL:COL diff --git a/tests/ui/threads-sendsync/rc-is-not-send.stderr b/tests/ui/threads-sendsync/rc-is-not-send.stderr index 28a74d89def6c..03e4b582cd0eb 100644 --- a/tests/ui/threads-sendsync/rc-is-not-send.stderr +++ b/tests/ui/threads-sendsync/rc-is-not-send.stderr @@ -18,12 +18,14 @@ note: required because it appears within the type `Port<()>` --> $DIR/rc-is-not-send.rs:7:8 | LL | struct Port(Rc); - | ^^^^ + | ^^^^ ----- required by this field note: required because it appears within the type `Foo` --> $DIR/rc-is-not-send.rs:10:8 | LL | struct Foo { | ^^^ +LL | _x: Port<()>, + | ------------ required by this field note: required because `x` is used within this closure --> $DIR/rc-is-not-send.rs:27:17 | diff --git a/tests/ui/trait-bounds/deep-level-send-bound-check-issue-40827.stderr b/tests/ui/trait-bounds/deep-level-send-bound-check-issue-40827.stderr index 3776c355318d0..bd4cabc78c990 100644 --- a/tests/ui/trait-bounds/deep-level-send-bound-check-issue-40827.stderr +++ b/tests/ui/trait-bounds/deep-level-send-bound-check-issue-40827.stderr @@ -12,12 +12,14 @@ note: required because it appears within the type `Bar` | LL | enum Bar { | ^^^ +LL | A(Rc), + | ------- required by this field = note: required for `Arc` to implement `Send` note: required because it appears within the type `Foo` --> $DIR/deep-level-send-bound-check-issue-40827.rs:4:8 | LL | struct Foo(Arc); - | ^^^ + | ^^^ -------- required by this field note: required by a bound in `f` --> $DIR/deep-level-send-bound-check-issue-40827.rs:11:9 | @@ -38,12 +40,14 @@ note: required because it appears within the type `Bar` | LL | enum Bar { | ^^^ +LL | A(Rc), + | ------- required by this field = note: required for `Arc` to implement `Send` note: required because it appears within the type `Foo` --> $DIR/deep-level-send-bound-check-issue-40827.rs:4:8 | LL | struct Foo(Arc); - | ^^^ + | ^^^ -------- required by this field note: required by a bound in `f` --> $DIR/deep-level-send-bound-check-issue-40827.rs:11:9 | diff --git a/tests/ui/traits/cycle-cache-err-60010.stderr b/tests/ui/traits/cycle-cache-err-60010.stderr index 9665d5badf599..e7aba17e060c3 100644 --- a/tests/ui/traits/cycle-cache-err-60010.stderr +++ b/tests/ui/traits/cycle-cache-err-60010.stderr @@ -20,6 +20,8 @@ note: required because it appears within the type `RootDatabase` | LL | struct RootDatabase { | ^^^^^^^^^^^^ +LL | _runtime: Runtime, + | ------------------------------- required by this field note: required for `RootDatabase` to implement `SourceDatabase` --> $DIR/cycle-cache-err-60010.rs:43:9 | @@ -59,6 +61,8 @@ note: required because it appears within the type `RootDatabase` | LL | struct RootDatabase { | ^^^^^^^^^^^^ +LL | _runtime: Runtime, + | ------------------------------- required by this field note: required for `RootDatabase` to implement `SourceDatabase` --> $DIR/cycle-cache-err-60010.rs:43:9 | diff --git a/tests/ui/traits/enum-negative-send-impl.stderr b/tests/ui/traits/enum-negative-send-impl.stderr index 2aad2265797e6..645d6d856eb1c 100644 --- a/tests/ui/traits/enum-negative-send-impl.stderr +++ b/tests/ui/traits/enum-negative-send-impl.stderr @@ -16,6 +16,8 @@ note: required because it appears within the type `Container` | LL | enum Container { | ^^^^^^^^^ +LL | WithNoSend(NoSend), + | ------ required by this field note: required by a bound in `requires_send` --> $DIR/enum-negative-send-impl.rs:16:21 | diff --git a/tests/ui/traits/enum-negative-sync-impl.stderr b/tests/ui/traits/enum-negative-sync-impl.stderr index b4ab69afb421d..8fdfbe6876266 100644 --- a/tests/ui/traits/enum-negative-sync-impl.stderr +++ b/tests/ui/traits/enum-negative-sync-impl.stderr @@ -16,6 +16,8 @@ note: required because it appears within the type `Container` | LL | enum Container { | ^^^^^^^^^ +LL | WithNoSync(NoSync), + | ------ required by this field note: required by a bound in `requires_sync` --> $DIR/enum-negative-sync-impl.rs:16:21 | diff --git a/tests/ui/traits/issue-7013.stderr b/tests/ui/traits/issue-7013.stderr index 1749366317286..8621072272259 100644 --- a/tests/ui/traits/issue-7013.stderr +++ b/tests/ui/traits/issue-7013.stderr @@ -12,6 +12,8 @@ note: required because it appears within the type `B` | LL | struct B { | ^ +LL | v: Option>> + | ------------------------- required by this field = note: required for the cast from `Box` to `Box` error: aborting due to 1 previous error diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr index b7d8484e1041e..356e0b9c18cd6 100644 --- a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -112,7 +112,7 @@ note: required because it appears within the type `Outer2` --> $DIR/negated-auto-traits-error.rs:12:8 | LL | struct Outer2(T); - | ^^^^^^ + | ^^^^^^ - required by this field = note: required for `std::ptr::Unique>` to implement `Send` note: required because it appears within the type `Box>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/traits/non-send-field-location-issue-146016.current.stderr b/tests/ui/traits/non-send-field-location-issue-146016.current.stderr index e13180a4f1071..1aad4cb4c7685 100644 --- a/tests/ui/traits/non-send-field-location-issue-146016.current.stderr +++ b/tests/ui/traits/non-send-field-location-issue-146016.current.stderr @@ -10,6 +10,9 @@ note: required because it appears within the type `Record<*const c_void>` | LL | struct Record { | ^^^^^^ +LL | unrelated: u8, +LL | value: T, + | -------- required by this field note: required by a bound in `require_send` --> $DIR/non-send-field-location-issue-146016.rs:38:20 | @@ -28,11 +31,16 @@ note: required because it appears within the type `Record<*const c_void>` | LL | struct Record { | ^^^^^^ +LL | unrelated: u8, +LL | value: T, + | -------- required by this field note: required because it appears within the type `Nested<*const c_void>` --> $DIR/non-send-field-location-issue-146016.rs:29:8 | LL | struct Nested { | ^^^^^^ +LL | value: Record, + | ---------------- required by this field note: required by a bound in `require_send` --> $DIR/non-send-field-location-issue-146016.rs:38:20 | @@ -51,6 +59,11 @@ note: required because it appears within the type `Multiple<*const c_void>` | LL | enum Multiple { | ^^^^^^^^ +LL | Empty, +LL | Values { first: T, second: T }, + | -------- --------- required by this field + | | + | required by this field note: required by a bound in `require_send` --> $DIR/non-send-field-location-issue-146016.rs:38:20 | @@ -76,6 +89,9 @@ note: required because it appears within the type `Foo` | LL | enum Foo { | ^^^ +LL | Case(i32), +LL | Case2(Bar), + | --- required by this field = note: required for `std::sync::mpsc::Receiver` to implement `Send` note: required because `rx` is used within this closure --> $DIR/non-send-field-location-issue-146016.rs:55:41 diff --git a/tests/ui/traits/non-send-field-location-issue-146016.next.stderr b/tests/ui/traits/non-send-field-location-issue-146016.next.stderr index e13180a4f1071..1aad4cb4c7685 100644 --- a/tests/ui/traits/non-send-field-location-issue-146016.next.stderr +++ b/tests/ui/traits/non-send-field-location-issue-146016.next.stderr @@ -10,6 +10,9 @@ note: required because it appears within the type `Record<*const c_void>` | LL | struct Record { | ^^^^^^ +LL | unrelated: u8, +LL | value: T, + | -------- required by this field note: required by a bound in `require_send` --> $DIR/non-send-field-location-issue-146016.rs:38:20 | @@ -28,11 +31,16 @@ note: required because it appears within the type `Record<*const c_void>` | LL | struct Record { | ^^^^^^ +LL | unrelated: u8, +LL | value: T, + | -------- required by this field note: required because it appears within the type `Nested<*const c_void>` --> $DIR/non-send-field-location-issue-146016.rs:29:8 | LL | struct Nested { | ^^^^^^ +LL | value: Record, + | ---------------- required by this field note: required by a bound in `require_send` --> $DIR/non-send-field-location-issue-146016.rs:38:20 | @@ -51,6 +59,11 @@ note: required because it appears within the type `Multiple<*const c_void>` | LL | enum Multiple { | ^^^^^^^^ +LL | Empty, +LL | Values { first: T, second: T }, + | -------- --------- required by this field + | | + | required by this field note: required by a bound in `require_send` --> $DIR/non-send-field-location-issue-146016.rs:38:20 | @@ -76,6 +89,9 @@ note: required because it appears within the type `Foo` | LL | enum Foo { | ^^^ +LL | Case(i32), +LL | Case2(Bar), + | --- required by this field = note: required for `std::sync::mpsc::Receiver` to implement `Send` note: required because `rx` is used within this closure --> $DIR/non-send-field-location-issue-146016.rs:55:41 diff --git a/tests/ui/traits/opaque-trait-size-error-5883.stderr b/tests/ui/traits/opaque-trait-size-error-5883.stderr index 78de250b19a1e..1cb25b281ce84 100644 --- a/tests/ui/traits/opaque-trait-size-error-5883.stderr +++ b/tests/ui/traits/opaque-trait-size-error-5883.stderr @@ -10,6 +10,8 @@ note: required because it appears within the type `Struct` | LL | struct Struct { | ^^^^^^ +LL | r: dyn A + 'static + | ------------------ required by this field = note: the return type of a function must have a statically known size error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time diff --git a/tests/ui/traits/suggest-where-clause.stderr b/tests/ui/traits/suggest-where-clause.stderr index d01cd26730c59..e56c7cd518bd2 100644 --- a/tests/ui/traits/suggest-where-clause.stderr +++ b/tests/ui/traits/suggest-where-clause.stderr @@ -28,7 +28,7 @@ note: required because it appears within the type `Misc` --> $DIR/suggest-where-clause.rs:3:8 | LL | struct Misc(T); - | ^^^^ + | ^^^^ - required by this field note: required by an implicit `Sized` bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL help: consider removing the `?Sized` bound to make the type parameter `Sized` diff --git a/tests/ui/traits/trivial-unsized-projection-2.bad.stderr b/tests/ui/traits/trivial-unsized-projection-2.bad.stderr index bf8d3c40cf653..d3b3b3be61f8f 100644 --- a/tests/ui/traits/trivial-unsized-projection-2.bad.stderr +++ b/tests/ui/traits/trivial-unsized-projection-2.bad.stderr @@ -9,7 +9,7 @@ note: required because it appears within the type `Tail` --> $DIR/trivial-unsized-projection-2.rs:17:8 | LL | struct Tail([()]); - | ^^^^ + | ^^^^ ---- required by this field note: required by a bound in `Bad::Assert` --> $DIR/trivial-unsized-projection-2.rs:14:15 | @@ -34,7 +34,7 @@ note: required because it appears within the type `Tail` --> $DIR/trivial-unsized-projection-2.rs:17:8 | LL | struct Tail([()]); - | ^^^^ + | ^^^^ ---- required by this field note: required by a bound in `Bad::Assert` --> $DIR/trivial-unsized-projection-2.rs:14:15 | diff --git a/tests/ui/traits/trivial-unsized-projection-2.bad_new.stderr b/tests/ui/traits/trivial-unsized-projection-2.bad_new.stderr index fcac02bc0a049..6f8558547026a 100644 --- a/tests/ui/traits/trivial-unsized-projection-2.bad_new.stderr +++ b/tests/ui/traits/trivial-unsized-projection-2.bad_new.stderr @@ -15,7 +15,7 @@ note: required because it appears within the type `Tail` --> $DIR/trivial-unsized-projection-2.rs:17:8 | LL | struct Tail([()]); - | ^^^^ + | ^^^^ ---- required by this field note: required by a bound in `Bad::Assert` --> $DIR/trivial-unsized-projection-2.rs:14:15 | diff --git a/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index 92629704c8986..00ad61a6d7794 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -27,6 +27,8 @@ note: required because it appears within the type `MyTypeWUnsafe` | LL | struct MyTypeWUnsafe { | ^^^^^^^^^^^^^ +LL | t: UnsafeCell + | ----------------- required by this field note: required by a bound in `is_sync` --> $DIR/typeck-default-trait-impl-negation-sync.rs:29:15 | @@ -49,6 +51,8 @@ note: required because it appears within the type `MyTypeManaged` | LL | struct MyTypeManaged { | ^^^^^^^^^^^^^ +LL | t: Managed + | ---------- required by this field note: required by a bound in `is_sync` --> $DIR/typeck-default-trait-impl-negation-sync.rs:29:15 | diff --git a/tests/ui/typeck/typeck-unsafe-always-share.stderr b/tests/ui/typeck/typeck-unsafe-always-share.stderr index c680c6ee27bf0..6239db91b52e8 100644 --- a/tests/ui/typeck/typeck-unsafe-always-share.stderr +++ b/tests/ui/typeck/typeck-unsafe-always-share.stderr @@ -42,6 +42,8 @@ note: required because it appears within the type `MySync` | LL | struct MySync { | ^^^^^^ +LL | u: UnsafeCell + | ---------------- required by this field note: required by a bound in `test` --> $DIR/typeck-unsafe-always-share.rs:15:12 | diff --git a/tests/ui/unsized-locals/issue-50940-with-feature.stderr b/tests/ui/unsized-locals/issue-50940-with-feature.stderr index f3fb3ac1a09ff..a0d7e9c6cba31 100644 --- a/tests/ui/unsized-locals/issue-50940-with-feature.stderr +++ b/tests/ui/unsized-locals/issue-50940-with-feature.stderr @@ -9,7 +9,7 @@ note: required because it appears within the type `A` --> $DIR/issue-50940-with-feature.rs:4:12 | LL | struct A(X); - | ^ + | ^ - required by this field = note: the return type of a function must have a statically known size error: aborting due to 1 previous error diff --git a/tests/ui/unsized-locals/unsized-exprs.stderr b/tests/ui/unsized-locals/unsized-exprs.stderr index 0455edbe8e77b..8d6156446d26f 100644 --- a/tests/ui/unsized-locals/unsized-exprs.stderr +++ b/tests/ui/unsized-locals/unsized-exprs.stderr @@ -9,7 +9,7 @@ note: required because it appears within the type `A<[u8]>` --> $DIR/unsized-exprs.rs:3:8 | LL | struct A(X); - | ^ + | ^ - required by this field note: unsized values must be place expressions and cannot be put in temporaries --> $DIR/unsized-exprs.rs:19:22 | @@ -27,7 +27,7 @@ note: required because it appears within the type `A<[u8]>` --> $DIR/unsized-exprs.rs:3:8 | LL | struct A(X); - | ^ + | ^ - required by this field note: unsized values must be place expressions and cannot be put in temporaries --> $DIR/unsized-exprs.rs:21:22 | diff --git a/tests/ui/unsized/unsized-enum2.stderr b/tests/ui/unsized/unsized-enum2.stderr index 71cf782120e57..20cf2556c5df7 100644 --- a/tests/ui/unsized/unsized-enum2.stderr +++ b/tests/ui/unsized/unsized-enum2.stderr @@ -325,7 +325,7 @@ note: required because it appears within the type `Path1` --> $DIR/unsized-enum2.rs:16:8 | LL | struct Path1(dyn PathHelper1); - | ^^^^^ + | ^^^^^ --------------- required by this field = note: no field of an enum variant may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size @@ -348,7 +348,7 @@ note: required because it appears within the type `Path2` --> $DIR/unsized-enum2.rs:17:8 | LL | struct Path2(dyn PathHelper2); - | ^^^^^ + | ^^^^^ --------------- required by this field = note: no field of an enum variant may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size @@ -371,7 +371,7 @@ note: required because it appears within the type `Path3` --> $DIR/unsized-enum2.rs:18:8 | LL | struct Path3(dyn PathHelper3); - | ^^^^^ + | ^^^^^ --------------- required by this field = note: no field of an enum variant may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size @@ -394,7 +394,7 @@ note: required because it appears within the type `Path4` --> $DIR/unsized-enum2.rs:19:8 | LL | struct Path4(dyn PathHelper4); - | ^^^^^ + | ^^^^^ --------------- required by this field = note: no field of an enum variant may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size diff --git a/tests/ui/unsized/unsized-struct.stderr b/tests/ui/unsized/unsized-struct.stderr index 06c4ffb7773c6..d7d392cf9e5f6 100644 --- a/tests/ui/unsized/unsized-struct.stderr +++ b/tests/ui/unsized/unsized-struct.stderr @@ -36,7 +36,7 @@ note: required because it appears within the type `Bar` --> $DIR/unsized-struct.rs:11:8 | LL | struct Bar { data: T } - | ^^^ + | ^^^ ------- required by this field note: required by a bound in `is_sized` --> $DIR/unsized-struct.rs:1:15 | diff --git a/tests/ui/unsized/unsized3.stderr b/tests/ui/unsized/unsized3.stderr index c7a145b1c5171..547bb9ca62e34 100644 --- a/tests/ui/unsized/unsized3.stderr +++ b/tests/ui/unsized/unsized3.stderr @@ -59,6 +59,8 @@ note: required because it appears within the type `S` | LL | struct S { | ^ +LL | x: X, + | ---- required by this field note: required by an implicit `Sized` bound in `f5` --> $DIR/unsized3.rs:24:7 | @@ -87,6 +89,8 @@ note: required because it appears within the type `S` | LL | struct S { | ^ +LL | x: X, + | ---- required by this field = note: only the last element of a tuple may have a dynamically sized type help: consider removing the `?Sized` bound to make the type parameter `Sized` | @@ -107,6 +111,8 @@ note: required because it appears within the type `S` | LL | struct S { | ^ +LL | x: X, + | ---- required by this field = note: required because it appears within the type `({integer}, S)` = note: tuples must have a statically known size to be initialized help: consider removing the `?Sized` bound to make the type parameter `Sized` @@ -130,6 +136,8 @@ note: required because it appears within the type `S` | LL | struct S { | ^ +LL | x: X, + | ---- required by this field = note: required because it appears within the type `({integer}, S)` note: required by an implicit `Sized` bound in `f5` --> $DIR/unsized3.rs:24:7 diff --git a/tests/ui/wf/let-pat-inferred-non-wf.stderr b/tests/ui/wf/let-pat-inferred-non-wf.stderr index 1c524a22b432b..d05ed37578820 100644 --- a/tests/ui/wf/let-pat-inferred-non-wf.stderr +++ b/tests/ui/wf/let-pat-inferred-non-wf.stderr @@ -54,7 +54,7 @@ note: required because it appears within the type `S` --> $DIR/let-pat-inferred-non-wf.rs:8:8 | LL | struct S(T); - | ^ + | ^ - required by this field = note: slice and array elements must have `Sized` type error: aborting due to 6 previous errors