Skip to content

Commit 3354f96

Browse files
Extend impl's def_span to include where clauses
1 parent b781645 commit 3354f96

30 files changed

+128
-69
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -972,10 +972,19 @@ impl<'hir> Map<'hir> {
972972
}
973973
// Constants and Statics.
974974
Node::Item(Item {
975-
kind:
976-
ItemKind::Const(ty, ..)
977-
| ItemKind::Static(ty, ..)
978-
| ItemKind::Impl(Impl { self_ty: ty, .. }),
975+
kind: ItemKind::Impl(Impl { self_ty: ty, generics, .. }),
976+
span: outer_span,
977+
..
978+
}) => until_within(
979+
*outer_span,
980+
if generics.has_where_clause_predicates {
981+
generics.where_clause_span
982+
} else {
983+
ty.span
984+
},
985+
),
986+
Node::Item(Item {
987+
kind: ItemKind::Const(ty, ..) | ItemKind::Static(ty, ..),
979988
span: outer_span,
980989
..
981990
})

src/tools/clippy/tests/ui/crashes/ice-6252.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LL | const VAL: T;
3131
| ------------ `VAL` from trait
3232
...
3333
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
34-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
34+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
3535

3636
error: aborting due to 3 previous errors
3737

tests/ui/associated-types/associated-types-coherence-failure.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Co
22
--> $DIR/associated-types-coherence-failure.rs:21:1
33
|
44
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
5-
| ------------------------------------------------------------ first implementation here
5+
| ----------------------------------------------------------------------------- first implementation here
66
...
77
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
99

1010
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_`
1111
--> $DIR/associated-types-coherence-failure.rs:28:1
1212
|
1313
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
14-
| ------------------------------------------------------------ first implementation here
14+
| ----------------------------------------------------------------------------- first implementation here
1515
...
1616
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned {
17-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
1818

1919
error: aborting due to 2 previous errors
2020

tests/ui/associated-types/hr-associated-type-bound-2.stderr

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
error[E0275]: overflow evaluating the requirement `for<'b> u32: X<'b>`
22
--> $DIR/hr-associated-type-bound-2.rs:11:1
33
|
4-
LL | impl X<'_> for u32
5-
| ^^^^^^^^^^^^^^^^^^
4+
LL | / impl X<'_> for u32
5+
LL | | where
6+
LL | | for<'b> <Self as X<'b>>::U: Clone,
7+
| |______________________________________^
68
|
79
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hr_associated_type_bound_2`)
810
note: required for `u32` to implement `for<'b> X<'b>`

tests/ui/associated-types/impl-wf-cycle-1.stderr

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
22
--> $DIR/impl-wf-cycle-1.rs:15:1
33
|
4-
LL | impl<T: Grault> Grault for (T,)
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | / impl<T: Grault> Grault for (T,)
5+
LL | |
6+
LL | | where
7+
LL | | Self::A: Baz,
8+
LL | | Self::B: Fiz,
9+
| |_________________^
610
|
711
note: required for `(T,)` to implement `Grault`
812
--> $DIR/impl-wf-cycle-1.rs:15:17

tests/ui/associated-types/impl-wf-cycle-2.stderr

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
22
--> $DIR/impl-wf-cycle-2.rs:7:1
33
|
4-
LL | impl<T: Grault> Grault for (T,)
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | / impl<T: Grault> Grault for (T,)
5+
LL | |
6+
LL | | where
7+
LL | | Self::A: Copy,
8+
| |__________________^
69
|
710
note: required for `(T,)` to implement `Grault`
811
--> $DIR/impl-wf-cycle-2.rs:7:17

tests/ui/coherence/coherence-overlap-downstream.next.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
1010
--> $DIR/coherence-overlap-downstream.rs:17:1
1111
|
1212
LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
13-
| ----------------------- first implementation here
13+
| --------------------------------------- first implementation here
1414
LL | impl<X> Foo<X> for i32 {}
1515
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
1616
|

tests/ui/coherence/coherence-overlap-downstream.old.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
1010
--> $DIR/coherence-overlap-downstream.rs:17:1
1111
|
1212
LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
13-
| ----------------------- first implementation here
13+
| --------------------------------------- first implementation here
1414
LL | impl<X> Foo<X> for i32 {}
1515
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
1616
|

tests/ui/coherence/coherence-overlap-upstream.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`
22
--> $DIR/coherence-overlap-upstream.rs:13:1
33
|
44
LL | impl<T> Foo for T where T: Remote {}
5-
| ----------------- first implementation here
5+
| --------------------------------- first implementation here
66
LL | impl Foo for i16 {}
77
| ^^^^^^^^^^^^^^^^ conflicting implementation for `i16`
88
|

tests/ui/coherence/coherence-wasm-bindgen.stderr

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
error: conflicting implementations of trait `IntoWasmAbi` for type `&dyn Fn(&_) -> _`
22
--> $DIR/coherence-wasm-bindgen.rs:28:1
33
|
4-
LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b)
5-
| ------------------------------------------------------------ first implementation here
4+
LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b)
5+
LL | | where
6+
LL | | A: FromWasmAbi,
7+
LL | | R: ReturnWasmAbi,
8+
| |_____________________- first implementation here
69
...
7-
LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b)
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&dyn Fn(&_) -> _`
10+
LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b)
11+
LL | | where
12+
LL | | A: RefFromWasmAbi,
13+
LL | | R: ReturnWasmAbi,
14+
| |_____________________^ conflicting implementation for `&dyn Fn(&_) -> _`
915
|
1016
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1117
= note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>

tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
error[E0119]: conflicting implementations of trait `From<()>` for type `S`
22
--> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1
33
|
4-
LL | impl From<()> for S {
5-
| ------------------- first implementation here
4+
LL | impl From<()> for S {
5+
| ------------------- first implementation here
66
...
7-
LL | impl<I> From<I> for S
8-
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
7+
LL | / impl<I> From<I> for S
8+
LL | |
9+
LL | | where
10+
LL | | I: Iterator<Item = ()>,
11+
| |___________________________^ conflicting implementation for `S`
912
|
1013
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
1114

tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
error[E0119]: conflicting implementations of trait `From<()>` for type `S`
22
--> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1
33
|
4-
LL | impl From<()> for S {
5-
| ------------------- first implementation here
4+
LL | impl From<()> for S {
5+
| ------------------- first implementation here
66
...
7-
LL | impl<I> From<I> for S
8-
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
7+
LL | / impl<I> From<I> for S
8+
LL | |
9+
LL | | where
10+
LL | | I: Iterator<Item = ()>,
11+
| |___________________________^ conflicting implementation for `S`
912
|
1013
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
1114

tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future
22
--> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1
33
|
4-
LL | #[derive(PartialEq, Default)]
5-
| --------- the second impl is here
4+
LL | #[derive(PartialEq, Default)]
5+
| --------- the second impl is here
66
...
7-
LL | impl<T, Q> PartialEq<Q> for Interval<T>
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here
7+
LL | / impl<T, Q> PartialEq<Q> for Interval<T>
8+
LL | |
9+
LL | |
10+
LL | | where
11+
LL | | T: Borrow<Q>,
12+
LL | | Q: ?Sized + PartialOrd,
13+
| |___________________________^ the first impl is here
914
|
1015
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1116
= note: for more information, see issue #114040 <https://github.com/rust-lang/rust/issues/114040>

tests/ui/const-generics/generic_const_exprs/issue-80742.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:
33

44
Box<dyn Any>
55
query stack during panic:
6-
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 25:18>::{constant#0}`
6+
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 27:32>::{constant#0}`
77
#1 [eval_to_valtree] evaluating type-level constant
88
end of query stack
99
error: aborting due to previous error

tests/ui/error-codes/E0374.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
22
--> $DIR/E0374.rs:8:1
33
|
4-
LL | impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | / impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
5+
LL | | where T: CoerceUnsized<U> {}
6+
| |_____________________________^
67
|
78
= note: expected a single field to be coerced, none found
89

tests/ui/error-codes/E0377.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion b
22
--> $DIR/E0377.rs:12:1
33
|
44
LL | impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {}
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: expected coercion between the same definition; expected `Foo`, found `Bar`
88

tests/ui/error-codes/E0476.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `CoerceUnsized<&Wrapper<_>>`
22
--> $DIR/E0476.rs:9:1
33
|
44
LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: conflicting implementation in crate `core`:
88
- 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
1212
--> $DIR/E0476.rs:9:1
1313
|
1414
LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
15-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616
|
1717
note: object type is valid for the lifetime `'a` as defined here
1818
--> $DIR/E0476.rs:9:6

tests/ui/invalid_dispatch_from_dyn_impls.stderr

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
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
22
--> $DIR/invalid_dispatch_from_dyn_impls.rs:10:1
33
|
4-
LL | impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | / impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
5+
LL | | where
6+
LL | | T: DispatchFromDyn<U>,
7+
| |__________________________^
68
|
79
= note: extra field `1` of type `i32` is not allowed
810

911
error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions
1012
--> $DIR/invalid_dispatch_from_dyn_impls.rs:21:1
1113
|
12-
LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
15+
LL | | where
16+
LL | | T: Unsize<U>,
17+
| |_________________^
1418
|
1519
= note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced
1620
= note: currently, 2 fields need coercions: `ptr1` (`*const T` to `*const U`), `ptr2` (`*const T` to `*const U`)
@@ -26,14 +30,18 @@ LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingT
2630
error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]`
2731
--> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1
2832
|
29-
LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
30-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33+
LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
34+
LL | | where
35+
LL | | T: Unsize<U>,
36+
| |_________________^
3137

3238
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
3339
--> $DIR/invalid_dispatch_from_dyn_impls.rs:46:1
3440
|
35-
LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
36-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41+
LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
42+
LL | | where
43+
LL | | T: Unsize<U>,
44+
| |_____________________^
3745
|
3846
= note: extra field `1` of type `OverAlignedZst` is not allowed
3947

tests/ui/issues/issue-43355.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Trait1<Box<_>>` for type `A`
22
--> $DIR/issue-43355.rs:13:1
33
|
44
LL | impl<X, T> Trait1<X> for T where T: Trait2<X> {
5-
| -------------------------- first implementation here
5+
| --------------------------------------------- first implementation here
66
...
77
LL | impl<X> Trait1<Box<X>> for A {
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`

tests/ui/issues/issue-77919.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ LL | const VAL: T;
2727
| ------------ `VAL` from trait
2828
...
2929
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
30-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
30+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
3131

3232
error: aborting due to 3 previous errors
3333

tests/ui/never_type/never-from-impl-is-reserved.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | impl MyTrait for MyFoo {}
55
| ---------------------- first implementation here
66
LL | // This will conflict with the first impl if we impl `for<T> T: From<!>`.
77
LL | impl<T> MyTrait for T where T: From<!> {}
8-
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
99
|
1010
= note: permitting this impl would forbid us from adding `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details
1111

tests/ui/privacy/private-in-public-warn.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ error: trait `traits_where::PrivTr` is more private than the item `traits_where:
246246
--> $DIR/private-in-public-warn.rs:68:5
247247
|
248248
LL | impl<T> Pub<T> where T: PrivTr {}
249-
| ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
249+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
250250
|
251251
note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
252252
--> $DIR/private-in-public-warn.rs:55:5

tests/ui/privacy/private-in-public.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ warning: trait `traits_where::PrivTr` is more private than the item `traits_wher
208208
--> $DIR/private-in-public.rs:52:5
209209
|
210210
LL | impl<T> Pub<T> where T: PrivTr {
211-
| ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
211+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
212212
|
213213
note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
214214
--> $DIR/private-in-public.rs:42:5

tests/ui/privacy/where-priv-type.stderr

+5-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ LL | struct PrivTy;
4141
warning: type `PrivTy` is more private than the item `S`
4242
--> $DIR/where-priv-type.rs:39:1
4343
|
44-
LL | impl S
45-
| ^^^^^^ implementation `S` is reachable at visibility `pub`
44+
LL | / impl S
45+
LL | |
46+
LL | | where
47+
LL | | PrivTy:
48+
| |___________^ implementation `S` is reachable at visibility `pub`
4649
|
4750
note: but type `PrivTy` is only usable at visibility `pub(crate)`
4851
--> $DIR/where-priv-type.rs:8:1

tests/ui/privacy/where-pub-type-impls-priv-trait.stderr

+5-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ LL | trait PrivTr {}
4141
warning: trait `PrivTr` is more private than the item `S`
4242
--> $DIR/where-pub-type-impls-priv-trait.rs:41:1
4343
|
44-
LL | impl S
45-
| ^^^^^^ implementation `S` is reachable at visibility `pub`
44+
LL | / impl S
45+
LL | |
46+
LL | | where
47+
LL | | PubTy: PrivTr
48+
| |_________________^ implementation `S` is reachable at visibility `pub`
4649
|
4750
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
4851
--> $DIR/where-pub-type-impls-priv-trait.rs:10:1

tests/ui/specialization/issue-52050.stderr

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ LL | #![feature(specialization)]
1111
error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()`
1212
--> $DIR/issue-52050.rs:28:1
1313
|
14-
LL | impl<I> IntoPyDictPointer for I
15-
| ------------------------------- first implementation here
14+
LL | / impl<I> IntoPyDictPointer for I
15+
LL | | where
16+
LL | | I: Iterator,
17+
| |________________- first implementation here
1618
...
17-
LL | impl IntoPyDictPointer for ()
18-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
19+
LL | impl IntoPyDictPointer for ()
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
1921
|
2022
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
2123

0 commit comments

Comments
 (0)