Skip to content

Commit

Permalink
Auto merge of rust-lang#116497 - compiler-errors:impl-span, r=cjgillot
Browse files Browse the repository at this point in the history
Extend `impl`'s `def_span` to include its where clauses

Typically, we highlight the def-span of an impl in a diagnostic due to either:
1. coherence error
2. trait evaluation cycle
3. invalid implementation of built-in trait

I find that an impl's where clauses are very often required to understanding why these errors come about, which is unfortunate since where clauses may be located on different lines and don't show up in the error. This PR expands the def-span of impls to include these where clauses.

r? cjgillot since you've touched this code a while back to make some spans shorter, but you can also reassign to wg-diagnostics or compiler if you're busy or have no strong opinions.
  • Loading branch information
bors committed Oct 9, 2023
2 parents cdddcd3 + 592163f commit 59edd67
Show file tree
Hide file tree
Showing 30 changed files with 122 additions and 69 deletions.
11 changes: 7 additions & 4 deletions compiler/rustc_middle/src/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
..
})
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/crashes/ice-6252.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LL | const VAL: T;
| ------------ `VAL` from trait
...
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation

error: aborting due to 3 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <B as ToOwned>::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 <B as ToOwned>::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

Expand Down
6 changes: 4 additions & 2 deletions tests/ui/associated-types/hr-associated-type-bound-2.stderr
Original file line number Diff line number Diff line change
@@ -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> <Self as X<'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>`
Expand Down
8 changes: 6 additions & 2 deletions tests/ui/associated-types/impl-wf-cycle-1.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
--> $DIR/impl-wf-cycle-1.rs:15:1
|
LL | impl<T: Grault> Grault for (T,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / impl<T: Grault> 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
Expand Down
7 changes: 5 additions & 2 deletions tests/ui/associated-types/impl-wf-cycle-2.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
--> $DIR/impl-wf-cycle-2.rs:7:1
|
LL | impl<T: Grault> Grault for (T,)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / impl<T: Grault> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
--> $DIR/coherence-overlap-downstream.rs:17:1
|
LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
| ----------------------- first implementation here
| --------------------------------------- first implementation here
LL | impl<X> Foo<X> for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/coherence-overlap-downstream.old.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
--> $DIR/coherence-overlap-downstream.rs:17:1
|
LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
| ----------------------- first implementation here
| --------------------------------------- first implementation here
LL | impl<X> Foo<X> for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/coherence-overlap-upstream.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`
--> $DIR/coherence-overlap-upstream.rs:13:1
|
LL | impl<T> Foo for T where T: Remote {}
| ----------------- first implementation here
| --------------------------------- first implementation here
LL | impl Foo for i16 {}
| ^^^^^^^^^^^^^^^^ conflicting implementation for `i16`
|
Expand Down
14 changes: 10 additions & 4 deletions tests/ui/coherence/coherence-wasm-bindgen.stderr
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/rust-lang/rust/issues/56105>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<I> From<I> for S
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
LL | / impl<I> From<I> for S
LL | |
LL | | where
LL | | I: Iterator<Item = ()>,
| |___________________________^ conflicting implementation for `S`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions

Expand Down
11 changes: 7 additions & 4 deletions tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
Original file line number Diff line number Diff line change
@@ -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<I> From<I> for S
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
LL | / impl<I> From<I> for S
LL | |
LL | | where
LL | | I: Iterator<Item = ()>,
| |___________________________^ conflicting implementation for `S`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions

Expand Down
13 changes: 9 additions & 4 deletions tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
error: implementations of `PartialEq<Interval<_>>` 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<T, Q> PartialEq<Q> for Interval<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here
LL | / impl<T, Q> PartialEq<Q> for Interval<T>
LL | |
LL | |
LL | | where
LL | | T: Borrow<Q>,
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 <https://github.com/rust-lang/rust/issues/114040>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:

Box<dyn Any>
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 25:18>::{constant#0}`
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 27:32>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
end of query stack
error: aborting due to previous error
Expand Down
5 changes: 3 additions & 2 deletions tests/ui/error-codes/E0374.stderr
Original file line number Diff line number Diff line change
@@ -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<T, U> CoerceUnsized<Foo<U>> for Foo<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
LL | | where T: CoerceUnsized<U> {}
| |_____________________________^
|
= note: expected a single field to be coerced, none found

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/error-codes/E0377.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion b
--> $DIR/E0377.rs:12:1
|
LL | impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected coercion between the same definition; expected `Foo`, found `Bar`

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/error-codes/E0476.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>> for &'b Wrapper<S> where S: Unsize<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<'a, 'b, T, U> CoerceUnsized<&'a U> for &'b T
Expand All @@ -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<T>> for &'b Wrapper<S> where S: Unsize<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: object type is valid for the lifetime `'a` as defined here
--> $DIR/E0476.rs:9:6
Expand Down
24 changes: 16 additions & 8 deletions tests/ui/invalid_dispatch_from_dyn_impls.stderr
Original file line number Diff line number Diff line change
@@ -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<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
LL | | where
LL | | T: DispatchFromDyn<U>,
| |__________________________^
|
= 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<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
LL | | where
LL | | T: Unsize<U>,
| |_________________^
|
= 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`)
Expand All @@ -26,14 +30,18 @@ LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> 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<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
LL | | where
LL | | T: Unsize<U>,
| |_________________^

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<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
LL | | where
LL | | T: Unsize<U>,
| |_____________________^
|
= note: extra field `1` of type `OverAlignedZst` is not allowed

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-43355.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Trait1<Box<_>>` for type `A`
--> $DIR/issue-43355.rs:13:1
|
LL | impl<X, T> Trait1<X> for T where T: Trait2<X> {
| -------------------------- first implementation here
| --------------------------------------------- first implementation here
...
LL | impl<X> Trait1<Box<X>> for A {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-77919.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LL | const VAL: T;
| ------------ `VAL` from trait
...
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation

error: aborting due to 3 previous errors

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/never_type/never-from-impl-is-reserved.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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> T: From<!>`.
LL | impl<T> MyTrait for T where T: From<!> {}
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
|
= note: permitting this impl would forbid us from adding `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/privacy/private-in-public-warn.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> Pub<T> where T: PrivTr {}
| ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` 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
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/privacy/private-in-public.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> Pub<T> where T: PrivTr {
| ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` 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
Expand Down
7 changes: 5 additions & 2 deletions tests/ui/privacy/where-priv-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions tests/ui/specialization/issue-52050.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ LL | #![feature(specialization)]
error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()`
--> $DIR/issue-52050.rs:28:1
|
LL | impl<I> IntoPyDictPointer for I
| ------------------------------- first implementation here
LL | / impl<I> 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

Expand Down
Loading

0 comments on commit 59edd67

Please sign in to comment.