From 592163fb71a07383141a882d185d80b874490982 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 6 Oct 2023 20:35:52 +0000 Subject: [PATCH] Extend impl's def_span to include where clauses --- compiler/rustc_middle/src/hir/map/mod.rs | 11 +++++---- .../clippy/tests/ui/crashes/ice-6252.stderr | 2 +- .../associated-types-coherence-failure.stderr | 8 +++---- .../hr-associated-type-bound-2.stderr | 6 +++-- .../associated-types/impl-wf-cycle-1.stderr | 8 +++++-- .../associated-types/impl-wf-cycle-2.stderr | 7 ++++-- .../coherence-overlap-downstream.next.stderr | 2 +- .../coherence-overlap-downstream.old.stderr | 2 +- .../coherence-overlap-upstream.stderr | 2 +- .../coherence/coherence-wasm-bindgen.stderr | 14 +++++++---- ...r-crate-ambiguity-causes-notes.next.stderr | 11 +++++---- ...er-crate-ambiguity-causes-notes.old.stderr | 11 +++++---- ...rn-when-cycle-is-error-in-coherence.stderr | 13 ++++++---- .../generic_const_exprs/issue-80742.stderr | 2 +- tests/ui/error-codes/E0374.stderr | 5 ++-- tests/ui/error-codes/E0377.stderr | 2 +- tests/ui/error-codes/E0476.stderr | 4 ++-- .../ui/invalid_dispatch_from_dyn_impls.stderr | 24 ++++++++++++------- tests/ui/issues/issue-43355.stderr | 2 +- tests/ui/issues/issue-77919.stderr | 2 +- .../never-from-impl-is-reserved.stderr | 2 +- .../ui/privacy/private-in-public-warn.stderr | 2 +- tests/ui/privacy/private-in-public.stderr | 2 +- tests/ui/privacy/where-priv-type.stderr | 7 ++++-- .../where-pub-type-impls-priv-trait.stderr | 7 ++++-- tests/ui/specialization/issue-52050.stderr | 10 ++++---- .../impl-bound-with-references-error.stderr | 7 ++++-- .../traits/issue-33140-hack-boundaries.stderr | 2 +- .../new-solver/coherence/issue-102048.stderr | 12 ++++++---- .../dont-ice-on-assoc-projection.stderr | 2 +- 30 files changed, 122 insertions(+), 69 deletions(-) diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 4af2d83e9c721..77643715fff5e 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -970,12 +970,15 @@ impl<'hir> Map<'hir> { // SyntaxContext of the visibility. sig.span.find_ancestor_in_same_ctxt(*outer_span).unwrap_or(*outer_span) } + // Impls, including their where clauses. + Node::Item(Item { + kind: ItemKind::Impl(Impl { generics, .. }), + span: outer_span, + .. + }) => until_within(*outer_span, generics.where_clause_span), // Constants and Statics. Node::Item(Item { - kind: - ItemKind::Const(ty, ..) - | ItemKind::Static(ty, ..) - | ItemKind::Impl(Impl { self_ty: ty, .. }), + kind: ItemKind::Const(ty, ..) | ItemKind::Static(ty, ..), span: outer_span, .. }) diff --git a/src/tools/clippy/tests/ui/crashes/ice-6252.stderr b/src/tools/clippy/tests/ui/crashes/ice-6252.stderr index cb65360d1291c..f929bec9583c5 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-6252.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-6252.stderr @@ -31,7 +31,7 @@ LL | const VAL: T; | ------------ `VAL` from trait ... LL | impl TypeVal for Multiply where N: TypeVal {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation error: aborting due to 3 previous errors diff --git a/tests/ui/associated-types/associated-types-coherence-failure.stderr b/tests/ui/associated-types/associated-types-coherence-failure.stderr index 40c02dca32f0d..211613b371492 100644 --- a/tests/ui/associated-types/associated-types-coherence-failure.stderr +++ b/tests/ui/associated-types/associated-types-coherence-failure.stderr @@ -2,19 +2,19 @@ error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Co --> $DIR/associated-types-coherence-failure.rs:21:1 | LL | impl<'a, B: ?Sized> IntoCow<'a, B> for ::Owned where B: ToOwned { - | ------------------------------------------------------------ first implementation here + | ----------------------------------------------------------------------------- first implementation here ... LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>` error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_` --> $DIR/associated-types-coherence-failure.rs:28:1 | LL | impl<'a, B: ?Sized> IntoCow<'a, B> for ::Owned where B: ToOwned { - | ------------------------------------------------------------ first implementation here + | ----------------------------------------------------------------------------- first implementation here ... LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` error: aborting due to 2 previous errors diff --git a/tests/ui/associated-types/hr-associated-type-bound-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-2.stderr index 749986f09c63d..8ccbc9fb5144a 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-2.stderr @@ -1,8 +1,10 @@ error[E0275]: overflow evaluating the requirement `for<'b> u32: X<'b>` --> $DIR/hr-associated-type-bound-2.rs:11:1 | -LL | impl X<'_> for u32 - | ^^^^^^^^^^^^^^^^^^ +LL | / impl X<'_> for u32 +LL | | where +LL | | for<'b> >::U: Clone, + | |______________________________________^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hr_associated_type_bound_2`) note: required for `u32` to implement `for<'b> X<'b>` diff --git a/tests/ui/associated-types/impl-wf-cycle-1.stderr b/tests/ui/associated-types/impl-wf-cycle-1.stderr index 206060f1980db..53022dcb4c787 100644 --- a/tests/ui/associated-types/impl-wf-cycle-1.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-1.stderr @@ -1,8 +1,12 @@ error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` --> $DIR/impl-wf-cycle-1.rs:15:1 | -LL | impl Grault for (T,) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / impl Grault for (T,) +LL | | +LL | | where +LL | | Self::A: Baz, +LL | | Self::B: Fiz, + | |_________________^ | note: required for `(T,)` to implement `Grault` --> $DIR/impl-wf-cycle-1.rs:15:17 diff --git a/tests/ui/associated-types/impl-wf-cycle-2.stderr b/tests/ui/associated-types/impl-wf-cycle-2.stderr index 771ba751e8c95..81c58be927e6d 100644 --- a/tests/ui/associated-types/impl-wf-cycle-2.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-2.stderr @@ -1,8 +1,11 @@ error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` --> $DIR/impl-wf-cycle-2.rs:7:1 | -LL | impl Grault for (T,) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / impl Grault for (T,) +LL | | +LL | | where +LL | | Self::A: Copy, + | |__________________^ | note: required for `(T,)` to implement `Grault` --> $DIR/impl-wf-cycle-2.rs:7:17 diff --git a/tests/ui/coherence/coherence-overlap-downstream.next.stderr b/tests/ui/coherence/coherence-overlap-downstream.next.stderr index 9d62efbc315b0..6c2e9466b4bde 100644 --- a/tests/ui/coherence/coherence-overlap-downstream.next.stderr +++ b/tests/ui/coherence/coherence-overlap-downstream.next.stderr @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32` --> $DIR/coherence-overlap-downstream.rs:17:1 | LL | impl Foo for T where T: Bar {} - | ----------------------- first implementation here + | --------------------------------------- first implementation here LL | impl Foo for i32 {} | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | diff --git a/tests/ui/coherence/coherence-overlap-downstream.old.stderr b/tests/ui/coherence/coherence-overlap-downstream.old.stderr index 9d62efbc315b0..6c2e9466b4bde 100644 --- a/tests/ui/coherence/coherence-overlap-downstream.old.stderr +++ b/tests/ui/coherence/coherence-overlap-downstream.old.stderr @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32` --> $DIR/coherence-overlap-downstream.rs:17:1 | LL | impl Foo for T where T: Bar {} - | ----------------------- first implementation here + | --------------------------------------- first implementation here LL | impl Foo for i32 {} | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | diff --git a/tests/ui/coherence/coherence-overlap-upstream.stderr b/tests/ui/coherence/coherence-overlap-upstream.stderr index f6145c1883a09..8272c88758607 100644 --- a/tests/ui/coherence/coherence-overlap-upstream.stderr +++ b/tests/ui/coherence/coherence-overlap-upstream.stderr @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16` --> $DIR/coherence-overlap-upstream.rs:13:1 | LL | impl Foo for T where T: Remote {} - | ----------------- first implementation here + | --------------------------------- first implementation here LL | impl Foo for i16 {} | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` | diff --git a/tests/ui/coherence/coherence-wasm-bindgen.stderr b/tests/ui/coherence/coherence-wasm-bindgen.stderr index 89615f0fbc63b..600cd42d8c69d 100644 --- a/tests/ui/coherence/coherence-wasm-bindgen.stderr +++ b/tests/ui/coherence/coherence-wasm-bindgen.stderr @@ -1,11 +1,17 @@ error: conflicting implementations of trait `IntoWasmAbi` for type `&dyn Fn(&_) -> _` --> $DIR/coherence-wasm-bindgen.rs:28:1 | -LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b) - | ------------------------------------------------------------ first implementation here +LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b) +LL | | where +LL | | A: FromWasmAbi, +LL | | R: ReturnWasmAbi, + | |_____________________- first implementation here ... -LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&dyn Fn(&_) -> _` +LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b) +LL | | where +LL | | A: RefFromWasmAbi, +LL | | R: ReturnWasmAbi, + | |_____________________^ conflicting implementation for `&dyn Fn(&_) -> _` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #56105 diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr index 0dd28706e0769..9b2dbc66ca7fd 100644 --- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr +++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr @@ -1,11 +1,14 @@ error[E0119]: conflicting implementations of trait `From<()>` for type `S` --> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1 | -LL | impl From<()> for S { - | ------------------- first implementation here +LL | impl From<()> for S { + | ------------------- first implementation here ... -LL | impl From for S - | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S` +LL | / impl From for S +LL | | +LL | | where +LL | | I: Iterator, + | |___________________________^ conflicting implementation for `S` | = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr index 0dd28706e0769..9b2dbc66ca7fd 100644 --- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr +++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr @@ -1,11 +1,14 @@ error[E0119]: conflicting implementations of trait `From<()>` for type `S` --> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1 | -LL | impl From<()> for S { - | ------------------- first implementation here +LL | impl From<()> for S { + | ------------------- first implementation here ... -LL | impl From for S - | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S` +LL | / impl From for S +LL | | +LL | | where +LL | | I: Iterator, + | |___________________________^ conflicting implementation for `S` | = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr index 89289767b838b..ecc73d994f9ac 100644 --- a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr +++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr @@ -1,11 +1,16 @@ error: implementations of `PartialEq>` for `Interval<_>` will conflict in the future --> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1 | -LL | #[derive(PartialEq, Default)] - | --------- the second impl is here +LL | #[derive(PartialEq, Default)] + | --------- the second impl is here ... -LL | impl PartialEq for Interval - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here +LL | / impl PartialEq for Interval +LL | | +LL | | +LL | | where +LL | | T: Borrow, +LL | | Q: ?Sized + PartialOrd, + | |___________________________^ the first impl is here | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #114040 diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr index 79ed82e02e0d6..25a455d3308a2 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr @@ -3,7 +3,7 @@ error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs: Box query stack during panic: -#0 [eval_to_allocation_raw] const-evaluating + checking `::{constant#0}` +#0 [eval_to_allocation_raw] const-evaluating + checking `::{constant#0}` #1 [eval_to_valtree] evaluating type-level constant end of query stack error: aborting due to previous error diff --git a/tests/ui/error-codes/E0374.stderr b/tests/ui/error-codes/E0374.stderr index a77920430672e..49ec0bce44169 100644 --- a/tests/ui/error-codes/E0374.stderr +++ b/tests/ui/error-codes/E0374.stderr @@ -1,8 +1,9 @@ error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures --> $DIR/E0374.rs:8:1 | -LL | impl CoerceUnsized> for Foo - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / impl CoerceUnsized> for Foo +LL | | where T: CoerceUnsized {} + | |_____________________________^ | = note: expected a single field to be coerced, none found diff --git a/tests/ui/error-codes/E0377.stderr b/tests/ui/error-codes/E0377.stderr index 664e499ec23a0..9cb11e5a3d3a5 100644 --- a/tests/ui/error-codes/E0377.stderr +++ b/tests/ui/error-codes/E0377.stderr @@ -2,7 +2,7 @@ error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion b --> $DIR/E0377.rs:12:1 | LL | impl CoerceUnsized> for Foo where T: CoerceUnsized {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expected coercion between the same definition; expected `Foo`, found `Bar` diff --git a/tests/ui/error-codes/E0476.stderr b/tests/ui/error-codes/E0476.stderr index a4bb26532a24f..0378ac6e8ec91 100644 --- a/tests/ui/error-codes/E0476.stderr +++ b/tests/ui/error-codes/E0476.stderr @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `CoerceUnsized<&Wrapper<_>>` --> $DIR/E0476.rs:9:1 | LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl<'a, 'b, T, U> CoerceUnsized<&'a U> for &'b T @@ -12,7 +12,7 @@ error[E0476]: lifetime of the source pointer does not outlive lifetime bound of --> $DIR/E0476.rs:9:1 | LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: object type is valid for the lifetime `'a` as defined here --> $DIR/E0476.rs:9:6 diff --git a/tests/ui/invalid_dispatch_from_dyn_impls.stderr b/tests/ui/invalid_dispatch_from_dyn_impls.stderr index 172ee7ade4903..168ed37d0e69f 100644 --- a/tests/ui/invalid_dispatch_from_dyn_impls.stderr +++ b/tests/ui/invalid_dispatch_from_dyn_impls.stderr @@ -1,16 +1,20 @@ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else --> $DIR/invalid_dispatch_from_dyn_impls.rs:10:1 | -LL | impl DispatchFromDyn> for WrapperWithExtraField - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / impl DispatchFromDyn> for WrapperWithExtraField +LL | | where +LL | | T: DispatchFromDyn, + | |__________________________^ | = note: extra field `1` of type `i32` is not allowed error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions --> $DIR/invalid_dispatch_from_dyn_impls.rs:21:1 | -LL | impl DispatchFromDyn> for MultiplePointers - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / impl DispatchFromDyn> for MultiplePointers +LL | | where +LL | | T: Unsize, + | |_________________^ | = note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced = note: currently, 2 fields need coercions: `ptr1` (`*const T` to `*const U`), `ptr2` (`*const T` to `*const U`) @@ -26,14 +30,18 @@ LL | impl DispatchFromDyn> for NothingT error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]` --> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1 | -LL | impl DispatchFromDyn> for HasReprC - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / impl DispatchFromDyn> for HasReprC +LL | | where +LL | | T: Unsize, + | |_________________^ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else --> $DIR/invalid_dispatch_from_dyn_impls.rs:46:1 | -LL | impl DispatchFromDyn> for OverAligned - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / impl DispatchFromDyn> for OverAligned +LL | | where +LL | | T: Unsize, + | |_____________________^ | = note: extra field `1` of type `OverAlignedZst` is not allowed diff --git a/tests/ui/issues/issue-43355.stderr b/tests/ui/issues/issue-43355.stderr index 57adc8ad5efc6..9aeca8efe4a66 100644 --- a/tests/ui/issues/issue-43355.stderr +++ b/tests/ui/issues/issue-43355.stderr @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Trait1>` for type `A` --> $DIR/issue-43355.rs:13:1 | LL | impl Trait1 for T where T: Trait2 { - | -------------------------- first implementation here + | --------------------------------------------- first implementation here ... LL | impl Trait1> for A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A` diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr index d6dcc8997b9ab..dbbe70ff06990 100644 --- a/tests/ui/issues/issue-77919.stderr +++ b/tests/ui/issues/issue-77919.stderr @@ -27,7 +27,7 @@ LL | const VAL: T; | ------------ `VAL` from trait ... LL | impl TypeVal for Multiply where N: TypeVal {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation error: aborting due to 3 previous errors diff --git a/tests/ui/never_type/never-from-impl-is-reserved.stderr b/tests/ui/never_type/never-from-impl-is-reserved.stderr index f9f7c787ecbc3..871c512052821 100644 --- a/tests/ui/never_type/never-from-impl-is-reserved.stderr +++ b/tests/ui/never_type/never-from-impl-is-reserved.stderr @@ -5,7 +5,7 @@ LL | impl MyTrait for MyFoo {} | ---------------------- first implementation here LL | // This will conflict with the first impl if we impl `for T: From`. LL | impl MyTrait for T where T: From {} - | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo` | = note: permitting this impl would forbid us from adding `impl From for T` later; see rust-lang/rust#64715 for details diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr index 6497b7ff535cb..ac7e5547de914 100644 --- a/tests/ui/privacy/private-in-public-warn.stderr +++ b/tests/ui/privacy/private-in-public-warn.stderr @@ -246,7 +246,7 @@ error: trait `traits_where::PrivTr` is more private than the item `traits_where: --> $DIR/private-in-public-warn.rs:68:5 | LL | impl Pub where T: PrivTr {} - | ^^^^^^^^^^^^^^ implementation `traits_where::Pub` is reachable at visibility `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub` is reachable at visibility `pub(crate)` | note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)` --> $DIR/private-in-public-warn.rs:55:5 diff --git a/tests/ui/privacy/private-in-public.stderr b/tests/ui/privacy/private-in-public.stderr index d8f9fd0071681..d3f7f0f637f5b 100644 --- a/tests/ui/privacy/private-in-public.stderr +++ b/tests/ui/privacy/private-in-public.stderr @@ -208,7 +208,7 @@ warning: trait `traits_where::PrivTr` is more private than the item `traits_wher --> $DIR/private-in-public.rs:52:5 | LL | impl Pub where T: PrivTr { - | ^^^^^^^^^^^^^^ implementation `traits_where::Pub` is reachable at visibility `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub` is reachable at visibility `pub(crate)` | note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)` --> $DIR/private-in-public.rs:42:5 diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr index dcc249c635119..650766458465d 100644 --- a/tests/ui/privacy/where-priv-type.stderr +++ b/tests/ui/privacy/where-priv-type.stderr @@ -41,8 +41,11 @@ LL | struct PrivTy; warning: type `PrivTy` is more private than the item `S` --> $DIR/where-priv-type.rs:39:1 | -LL | impl S - | ^^^^^^ implementation `S` is reachable at visibility `pub` +LL | / impl S +LL | | +LL | | where +LL | | PrivTy: + | |___________^ implementation `S` is reachable at visibility `pub` | note: but type `PrivTy` is only usable at visibility `pub(crate)` --> $DIR/where-priv-type.rs:8:1 diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr index c476874332c57..ee79ce3f5d750 100644 --- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr +++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr @@ -41,8 +41,11 @@ LL | trait PrivTr {} warning: trait `PrivTr` is more private than the item `S` --> $DIR/where-pub-type-impls-priv-trait.rs:41:1 | -LL | impl S - | ^^^^^^ implementation `S` is reachable at visibility `pub` +LL | / impl S +LL | | +LL | | where +LL | | PubTy: PrivTr + | |_________________^ implementation `S` is reachable at visibility `pub` | note: but trait `PrivTr` is only usable at visibility `pub(crate)` --> $DIR/where-pub-type-impls-priv-trait.rs:10:1 diff --git a/tests/ui/specialization/issue-52050.stderr b/tests/ui/specialization/issue-52050.stderr index c263fe4672427..85aac16f6d036 100644 --- a/tests/ui/specialization/issue-52050.stderr +++ b/tests/ui/specialization/issue-52050.stderr @@ -11,11 +11,13 @@ LL | #![feature(specialization)] error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()` --> $DIR/issue-52050.rs:28:1 | -LL | impl IntoPyDictPointer for I - | ------------------------------- first implementation here +LL | / impl IntoPyDictPointer for I +LL | | where +LL | | I: Iterator, + | |________________- first implementation here ... -LL | impl IntoPyDictPointer for () - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` +LL | impl IntoPyDictPointer for () + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions diff --git a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr index b114d295d7816..63280b8616fe5 100644 --- a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr +++ b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr @@ -12,8 +12,11 @@ LL + use std::borrow::Cow; error[E0119]: conflicting implementations of trait `From` for type `LabelText` --> $DIR/impl-bound-with-references-error.rs:9:1 | -LL | impl From for LabelText - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / impl From for LabelText +LL | | +LL | | where +LL | | T: Into>, + | |_______________________________^ | = note: conflicting implementation in crate `core`: - impl From for T; diff --git a/tests/ui/traits/issue-33140-hack-boundaries.stderr b/tests/ui/traits/issue-33140-hack-boundaries.stderr index 80a502c6335e2..06e1dfd372751 100644 --- a/tests/ui/traits/issue-33140-hack-boundaries.stderr +++ b/tests/ui/traits/issue-33140-hack-boundaries.stderr @@ -60,7 +60,7 @@ error[E0119]: conflicting implementations of trait `Trait5` for type `(dyn Send LL | impl Trait5 for dyn Send {} | ------------------------ first implementation here LL | impl Trait5 for dyn Send where u32: Copy {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)` error: aborting due to 8 previous errors diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.stderr b/tests/ui/traits/new-solver/coherence/issue-102048.stderr index 17a43838fe275..41bf68a1d9f39 100644 --- a/tests/ui/traits/new-solver/coherence/issue-102048.stderr +++ b/tests/ui/traits/new-solver/coherence/issue-102048.stderr @@ -1,11 +1,15 @@ error[E0119]: conflicting implementations of trait `Trait fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)` --> $DIR/issue-102048.rs:39:1 | -LL | impl Trait fn(>::Assoc, >::Assoc)> for (T, U) - | --------------------------------------------------------------------------------------------------- first implementation here +LL | / impl Trait fn(>::Assoc, >::Assoc)> for (T, U) +LL | | where +LL | | T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>, +LL | | U: for<'a> WithAssoc2<'a>, + | |______________________________- first implementation here ... -LL | impl Trait fn(>::Assoc, u32)> for (T, U) where - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` +LL | / impl Trait fn(>::Assoc, u32)> for (T, U) where +LL | | U: for<'a> WithAssoc1<'a> + | |_____________________________^ conflicting implementation for `(_, _)` error: aborting due to previous error diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr index 7ad495a35e0df..368f5cd0c3b1a 100644 --- a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr +++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr @@ -13,7 +13,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `()` LL | impl Foo for () {} | --------------- first implementation here LL | impl Foo for T where T: Bar {} - | ^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` error: aborting due to 2 previous errors