Skip to content

Commit 2aabb0f

Browse files
Point at impl self type for impl wf obligations
1 parent d76e168 commit 2aabb0f

31 files changed

+97
-97
lines changed

Diff for: compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ fn check_impl<'tcx>(
12721272
wfcx.param_env,
12731273
wfcx.body_id,
12741274
&trait_pred,
1275-
ast_trait_ref.path.span,
1275+
ast_self_ty.span,
12761276
item,
12771277
);
12781278
debug!(?obligations);

Diff for: tests/ui/associated-types/hr-associated-type-bound-param-6.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: the trait bound `for<'b> T: X<'b, T>` is not satisfied
2-
--> $DIR/hr-associated-type-bound-param-6.rs:12:12
2+
--> $DIR/hr-associated-type-bound-param-6.rs:12:25
33
|
44
LL | impl<S, T> X<'_, T> for (S,) {
5-
| ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T`
5+
| ^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T`
66
|
77
help: consider restricting type parameter `T`
88
|

Diff for: tests/ui/associated-types/hr-associated-type-projection-1.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
2-
--> $DIR/hr-associated-type-projection-1.rs:13:33
2+
--> $DIR/hr-associated-type-projection-1.rs:13:55
33
|
44
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T {
5-
| - this type parameter ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
5+
| - this type parameter ^ expected type parameter `T`, found associated type
66
|
77
= note: expected type parameter `T`
88
found associated type `<T as Deref>::Target`

Diff for: tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: `T` cannot be sent between threads safely
2-
--> $DIR/builtin-superkinds-double-superkind.rs:6:24
2+
--> $DIR/builtin-superkinds-double-superkind.rs:6:32
33
|
44
LL | impl <T: Sync+'static> Foo for (T,) { }
5-
| ^^^ `T` cannot be sent between threads safely
5+
| ^^^^ `T` cannot be sent between threads safely
66
|
77
= note: required because it appears within the type `(T,)`
88
note: required by a bound in `Foo`
@@ -16,10 +16,10 @@ LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { }
1616
| +++++++++++++++++++
1717

1818
error[E0277]: `T` cannot be shared between threads safely
19-
--> $DIR/builtin-superkinds-double-superkind.rs:9:16
19+
--> $DIR/builtin-superkinds-double-superkind.rs:9:24
2020
|
2121
LL | impl <T: Send> Foo for (T,T) { }
22-
| ^^^ `T` cannot be shared between threads safely
22+
| ^^^^^ `T` cannot be shared between threads safely
2323
|
2424
= note: required because it appears within the type `(T, T)`
2525
note: required by a bound in `Foo`

Diff for: tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: `T` cannot be sent between threads safely
2-
--> $DIR/builtin-superkinds-in-metadata.rs:13:23
2+
--> $DIR/builtin-superkinds-in-metadata.rs:13:56
33
|
44
LL | impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely
5+
| ^^^^ `T` cannot be sent between threads safely
66
|
77
note: required because it appears within the type `X<T>`
88
--> $DIR/builtin-superkinds-in-metadata.rs:9:8

Diff for: tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0310]: the parameter type `T` may not live long enough
2-
--> $DIR/builtin-superkinds-self-type.rs:10:16
2+
--> $DIR/builtin-superkinds-self-type.rs:10:24
33
|
44
LL | impl <T: Sync> Foo for T { }
5-
| ^^^ ...so that the type `T` will meet its required lifetime bounds...
5+
| ^ ...so that the type `T` will meet its required lifetime bounds...
66
|
77
note: ...that is required by this bound
88
--> $DIR/builtin-superkinds-self-type.rs:6:24

Diff for: tests/ui/builtin-superkinds/builtin-superkinds-simple.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: `Rc<i8>` cannot be sent between threads safely
2-
--> $DIR/builtin-superkinds-simple.rs:6:6
2+
--> $DIR/builtin-superkinds-simple.rs:6:14
33
|
44
LL | impl Foo for std::rc::Rc<i8> { }
5-
| ^^^ `Rc<i8>` cannot be sent between threads safely
5+
| ^^^^^^^^^^^^^^^ `Rc<i8>` cannot be sent between threads safely
66
|
77
= help: the trait `Send` is not implemented for `Rc<i8>`
88
note: required by a bound in `Foo`

Diff for: tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: `T` cannot be sent between threads safely
2-
--> $DIR/builtin-superkinds-typaram-not-send.rs:5:24
2+
--> $DIR/builtin-superkinds-typaram-not-send.rs:5:32
33
|
44
LL | impl <T: Sync+'static> Foo for T { }
5-
| ^^^ `T` cannot be sent between threads safely
5+
| ^ `T` cannot be sent between threads safely
66
|
77
note: required by a bound in `Foo`
88
--> $DIR/builtin-superkinds-typaram-not-send.rs:3:13

Diff for: tests/ui/chalkify/impl_wf.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: the size for values of type `str` cannot be known at compilation time
2-
--> $DIR/impl_wf.rs:11:6
2+
--> $DIR/impl_wf.rs:11:14
33
|
44
LL | impl Foo for str { }
5-
| ^^^ doesn't have a size known at compile-time
5+
| ^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `str`
88
note: required by a bound in `Foo`
@@ -12,10 +12,10 @@ LL | trait Foo: Sized { }
1212
| ^^^^^ required by this bound in `Foo`
1313

1414
error[E0277]: the trait bound `f32: Foo` is not satisfied
15-
--> $DIR/impl_wf.rs:22:6
15+
--> $DIR/impl_wf.rs:22:19
1616
|
1717
LL | impl Baz<f32> for f32 { }
18-
| ^^^^^^^^ the trait `Foo` is not implemented for `f32`
18+
| ^^^ the trait `Foo` is not implemented for `f32`
1919
|
2020
= help: the trait `Foo` is implemented for `i32`
2121
note: required by a bound in `Baz`

Diff for: tests/ui/coherence/coherence-overlap-trait-alias.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0283]: type annotations needed: cannot satisfy `u32: C`
2-
--> $DIR/coherence-overlap-trait-alias.rs:15:6
2+
--> $DIR/coherence-overlap-trait-alias.rs:15:12
33
|
44
LL | impl C for u32 {}
5-
| ^
5+
| ^^^
66
|
77
note: multiple `impl`s satisfying `u32: C` found
88
--> $DIR/coherence-overlap-trait-alias.rs:14:1

Diff for: tests/ui/const-generics/issues/issue-67185-2.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ LL | [<u8 as Baz>::Quaks; 2]: Bar,
2323
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
2424

2525
error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
26-
--> $DIR/issue-67185-2.rs:21:6
26+
--> $DIR/issue-67185-2.rs:21:14
2727
|
2828
LL | impl Foo for FooImpl {}
29-
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
29+
| ^^^^^^^ the trait `Bar` is not implemented for `[u16; 3]`
3030
|
3131
= help: the following other types implement trait `Bar`:
3232
[[u16; 3]; 3]
@@ -41,10 +41,10 @@ LL | <u8 as Baz>::Quaks: Bar,
4141
| ^^^ required by this bound in `Foo`
4242

4343
error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
44-
--> $DIR/issue-67185-2.rs:21:6
44+
--> $DIR/issue-67185-2.rs:21:14
4545
|
4646
LL | impl Foo for FooImpl {}
47-
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
47+
| ^^^^^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
4848
|
4949
= help: the following other types implement trait `Bar`:
5050
[[u16; 3]; 3]

Diff for: tests/ui/dst/dst-sized-trait-param.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: the size for values of type `[isize]` cannot be known at compilation time
2-
--> $DIR/dst-sized-trait-param.rs:7:6
2+
--> $DIR/dst-sized-trait-param.rs:7:23
33
|
44
LL | impl Foo<[isize]> for usize { }
5-
| ^^^^^^^^^^^^ doesn't have a size known at compile-time
5+
| ^^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `[isize]`
88
note: required by a bound in `Foo`
@@ -16,10 +16,10 @@ LL | trait Foo<T: ?Sized> : Sized { fn take(self, x: &T) { } } // Note: T is siz
1616
| ++++++++
1717

1818
error[E0277]: the size for values of type `[usize]` cannot be known at compilation time
19-
--> $DIR/dst-sized-trait-param.rs:10:6
19+
--> $DIR/dst-sized-trait-param.rs:10:21
2020
|
2121
LL | impl Foo<isize> for [usize] { }
22-
| ^^^^^^^^^^ doesn't have a size known at compile-time
22+
| ^^^^^^^ doesn't have a size known at compile-time
2323
|
2424
= help: the trait `Sized` is not implemented for `[usize]`
2525
note: required by a bound in `Foo`

Diff for: tests/ui/error-codes/E0308-2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0308]: mismatched types
2-
--> $DIR/E0308-2.rs:9:6
2+
--> $DIR/E0308-2.rs:9:13
33
|
44
LL | impl Eq for &dyn DynEq {}
5-
| ^^ lifetime mismatch
5+
| ^^^^^^^^^^ lifetime mismatch
66
|
77
= note: expected trait `<&dyn DynEq as PartialEq>`
88
found trait `<&(dyn DynEq + 'static) as PartialEq>`

Diff for: tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0309]: the parameter type `T` may not live long enough
2-
--> $DIR/implied-bounds-unnorm-associated-type-5.rs:6:13
2+
--> $DIR/implied-bounds-unnorm-associated-type-5.rs:6:27
33
|
44
LL | impl<'a, T> Trait<'a> for T {
5-
| ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
5+
| ^ ...so that the type `T` will meet its required lifetime bounds...
66
|
77
note: ...that is required by this bound
88
--> $DIR/implied-bounds-unnorm-associated-type-5.rs:1:18

Diff for: tests/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: the size for values of type `[()]` cannot be known at compilation time
2-
--> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:19:6
2+
--> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:19:17
33
|
44
LL | impl Tsized for () {}
5-
| ^^^^^^ doesn't have a size known at compile-time
5+
| ^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `[()]`
88
note: required by a bound in `Tsized`

Diff for: tests/ui/issues/issue-10412.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ LL | impl<'self> Serializable<'_, str> for &'self str {
5353
| +++
5454

5555
error[E0277]: the size for values of type `str` cannot be known at compilation time
56-
--> $DIR/issue-10412.rs:7:13
56+
--> $DIR/issue-10412.rs:7:35
5757
|
5858
LL | impl<'self> Serializable<str> for &'self str {
59-
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
59+
| ^^^^^^^^^^ doesn't have a size known at compile-time
6060
|
6161
= help: the trait `Sized` is not implemented for `str`
6262
note: required by a bound in `Serializable`

Diff for: tests/ui/issues/issue-65230.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0308]: mismatched types
2-
--> $DIR/issue-65230.rs:8:6
2+
--> $DIR/issue-65230.rs:8:13
33
|
44
LL | impl T1 for &dyn T2 {}
5-
| ^^ lifetime mismatch
5+
| ^^^^^^^ lifetime mismatch
66
|
77
= note: expected trait `<&dyn T2 as T0>`
88
found trait `<&(dyn T2 + 'static) as T0>`

Diff for: tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0283]: type annotations needed: cannot satisfy `&(): Marker`
2-
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:6
2+
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:17
33
|
44
LL | impl Marker for &'_ () {}
5-
| ^^^^^^
5+
| ^^^^^^
66
|
77
note: multiple `impl`s satisfying `&(): Marker` found
88
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1
@@ -13,10 +13,10 @@ LL | impl Marker for &'_ () {}
1313
| ^^^^^^^^^^^^^^^^^^^^^^
1414

1515
error[E0283]: type annotations needed: cannot satisfy `&(): Marker`
16-
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:7:6
16+
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:7:17
1717
|
1818
LL | impl Marker for &'_ () {}
19-
| ^^^^^^
19+
| ^^^^^^
2020
|
2121
note: multiple `impl`s satisfying `&(): Marker` found
2222
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1

Diff for: tests/ui/marker_trait_attr/region-overlap.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0283]: type annotations needed: cannot satisfy `(&'static (), &'a ()): A`
2-
--> $DIR/region-overlap.rs:5:10
2+
--> $DIR/region-overlap.rs:5:16
33
|
44
LL | impl<'a> A for (&'static (), &'a ()) {}
5-
| ^
5+
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: multiple `impl`s satisfying `(&'static (), &'a ()): A` found
88
--> $DIR/region-overlap.rs:5:1
@@ -13,10 +13,10 @@ LL | impl<'a> A for (&'a (), &'static ()) {}
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414

1515
error[E0283]: type annotations needed: cannot satisfy `(&'a (), &'static ()): A`
16-
--> $DIR/region-overlap.rs:6:10
16+
--> $DIR/region-overlap.rs:6:16
1717
|
1818
LL | impl<'a> A for (&'a (), &'static ()) {}
19-
| ^
19+
| ^^^^^^^^^^^^^^^^^^^^^
2020
|
2121
note: multiple `impl`s satisfying `(&'a (), &'static ()): A` found
2222
--> $DIR/region-overlap.rs:5:1

Diff for: tests/ui/overloaded/overloaded-calls-nontuple.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0059]: type parameter to bare `FnMut` trait must be a tuple
2-
--> $DIR/overloaded-calls-nontuple.rs:10:6
2+
--> $DIR/overloaded-calls-nontuple.rs:10:23
33
|
44
LL | impl FnMut<isize> for S {
5-
| ^^^^^^^^^^^^ the trait `Tuple` is not implemented for `isize`
5+
| ^ the trait `Tuple` is not implemented for `isize`
66
|
77
note: required by a bound in `FnMut`
88
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
99

1010
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
11-
--> $DIR/overloaded-calls-nontuple.rs:18:6
11+
--> $DIR/overloaded-calls-nontuple.rs:18:24
1212
|
1313
LL | impl FnOnce<isize> for S {
14-
| ^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `isize`
14+
| ^ the trait `Tuple` is not implemented for `isize`
1515
|
1616
note: required by a bound in `FnOnce`
1717
--> $SRC_DIR/core/src/ops/function.rs:LL:COL

Diff for: tests/ui/rfc-2632-const-trait-impl/super-traits-fail.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0277]: the trait bound `S: ~const Foo` is not satisfied
2-
--> $DIR/super-traits-fail.rs:15:12
2+
--> $DIR/super-traits-fail.rs:15:20
33
|
44
LL | impl const Bar for S {}
5-
| ^^^ the trait `~const Foo` is not implemented for `S`
5+
| ^ the trait `~const Foo` is not implemented for `S`
66
|
77
note: the trait `Foo` is implemented for `S`, but that implementation is not `const`
8-
--> $DIR/super-traits-fail.rs:15:12
8+
--> $DIR/super-traits-fail.rs:15:20
99
|
1010
LL | impl const Bar for S {}
11-
| ^^^
11+
| ^
1212
note: required by a bound in `Bar`
1313
--> $DIR/super-traits-fail.rs:8:12
1414
|

Diff for: tests/ui/span/issue-71363.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error[E0277]: `MyError` doesn't implement `std::fmt::Display`
2-
--> $DIR/issue-71363.rs:4:6
2+
--> $DIR/issue-71363.rs:4:28
33
|
44
4 | impl std::error::Error for MyError {}
5-
| ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted with the default formatter
5+
| ^^^^^^^ `MyError` cannot be formatted with the default formatter
66
|
77
= help: the trait `std::fmt::Display` is not implemented for `MyError`
88
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
99
note: required by a bound in `std::error::Error`
1010
--> $SRC_DIR/core/src/error.rs:LL:COL
1111

1212
error[E0277]: `MyError` doesn't implement `Debug`
13-
--> $DIR/issue-71363.rs:4:6
13+
--> $DIR/issue-71363.rs:4:28
1414
|
1515
4 | impl std::error::Error for MyError {}
16-
| ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted using `{:?}`
16+
| ^^^^^^^ `MyError` cannot be formatted using `{:?}`
1717
|
1818
= help: the trait `Debug` is not implemented for `MyError`
1919
= note: add `#[derive(Debug)]` to `MyError` or manually `impl Debug for MyError`

Diff for: tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ LL | #![feature(specialization)]
99
= note: `#[warn(incomplete_features)]` on by default
1010

1111
error[E0277]: the trait bound `U: Eq` is not satisfied
12-
--> $DIR/specialization-wfcheck.rs:7:17
12+
--> $DIR/specialization-wfcheck.rs:7:37
1313
|
1414
LL | default impl<U> Foo<'static, U> for () {}
15-
| ^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `U`
15+
| ^^ the trait `Eq` is not implemented for `U`
1616
|
1717
note: required by a bound in `Foo`
1818
--> $DIR/specialization-wfcheck.rs:5:18

Diff for: tests/ui/static/static-lifetime.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0478]: lifetime bound not satisfied
2-
--> $DIR/static-lifetime.rs:3:20
2+
--> $DIR/static-lifetime.rs:3:34
33
|
44
LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {}
5-
| ^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: lifetime parameter instantiated with the lifetime `'a` as defined here
88
--> $DIR/static-lifetime.rs:3:6

0 commit comments

Comments
 (0)