Skip to content

Commit 19728a9

Browse files
committed
Provide more context on derived obligation error primary label
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
1 parent 6351247 commit 19728a9

File tree

196 files changed

+382
-373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+382
-373
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+25-16
Original file line numberDiff line numberDiff line change
@@ -1432,20 +1432,18 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
14321432
) -> bool {
14331433
let span = obligation.cause.span;
14341434

1435-
let code = if let ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } =
1436-
obligation.cause.code()
1437-
{
1438-
parent_code
1439-
} else if let ObligationCauseCode::ItemObligation(_)
1440-
| ObligationCauseCode::ExprItemObligation(..) = obligation.cause.code()
1441-
{
1442-
obligation.cause.code()
1443-
} else if let ExpnKind::Desugaring(DesugaringKind::ForLoop) =
1444-
span.ctxt().outer_expn_data().kind
1445-
{
1446-
obligation.cause.code()
1447-
} else {
1448-
return false;
1435+
let code = match obligation.cause.code() {
1436+
ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } => parent_code,
1437+
c @ ObligationCauseCode::ItemObligation(_)
1438+
| c @ ObligationCauseCode::ExprItemObligation(..) => c,
1439+
c if matches!(
1440+
span.ctxt().outer_expn_data().kind,
1441+
ExpnKind::Desugaring(DesugaringKind::ForLoop)
1442+
) =>
1443+
{
1444+
c
1445+
}
1446+
_ => return false,
14491447
};
14501448

14511449
// List of traits for which it would be nonsensical to suggest borrowing.
@@ -4978,16 +4976,27 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>(
49784976
_ => None,
49794977
};
49804978

4979+
let pred = obligation.predicate;
4980+
let (_, base) = obligation.cause.code().peel_derives_with_predicate();
4981+
let post = if let ty::PredicateKind::Clause(clause) = pred.kind().skip_binder()
4982+
&& let ty::ClauseKind::Trait(pred) = clause
4983+
&& let Some(base) = base
4984+
&& base.skip_binder() != pred
4985+
{
4986+
format!(", which is required by `{base}`")
4987+
} else {
4988+
String::new()
4989+
};
49814990
match ty_desc {
49824991
Some(desc) => format!(
4983-
"{}the trait `{}` is not implemented for {} `{}`",
4992+
"{}the trait `{}` is not implemented for {} `{}`{post}",
49844993
pre_message,
49854994
trait_predicate.print_modifiers_and_trait_path(),
49864995
desc,
49874996
tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
49884997
),
49894998
None => format!(
4990-
"{}the trait `{}` is not implemented for `{}`",
4999+
"{}the trait `{}` is not implemented for `{}`{post}",
49915000
pre_message,
49925001
trait_predicate.print_modifiers_and_trait_path(),
49935002
tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),

tests/ui/associated-consts/issue-58022.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
1313
LL | fn new(slice: &[u8; Self::SIZE]) -> Self {
1414
| ^^^^ doesn't have a size known at compile-time
1515
|
16-
= help: within `Bar<[u8]>`, the trait `Sized` is not implemented for `[u8]`
16+
= help: within `Bar<[u8]>`, the trait `Sized` is not implemented for `[u8]`, which is required by `Bar<[u8]>: Sized`
1717
note: required because it appears within the type `Bar<[u8]>`
1818
--> $DIR/issue-58022.rs:8:12
1919
|

tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error: future cannot be sent between threads safely
1313
LL | is_send(foo::<T>());
1414
| ^^^^^^^^^^ future returned by `foo` is not `Send`
1515
|
16-
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`
16+
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`, which is required by `impl Future<Output = Result<(), ()>>: Send`
1717
note: future is not `Send` as it awaits another future which is not `Send`
1818
--> $DIR/basic.rs:13:5
1919
|

tests/ui/associated-types/defaults-suitability.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied
3939
--> $DIR/defaults-suitability.rs:28:23
4040
|
4141
LL | type Bar: Clone = Vec<T>;
42-
| ^^^^^^ the trait `Clone` is not implemented for `T`
42+
| ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `Vec<T>: Clone`
4343
|
4444
= note: required for `Vec<T>` to implement `Clone`
4545
note: required by a bound in `Foo::Bar`
@@ -88,7 +88,7 @@ error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: Clone` is not satisfied
8888
--> $DIR/defaults-suitability.rs:65:23
8989
|
9090
LL | type Bar: Clone = Vec<Self::Baz>;
91-
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz`
91+
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz`, which is required by `Vec<<Self as Foo2<T>>::Baz>: Clone`
9292
|
9393
= note: required for `Vec<<Self as Foo2<T>>::Baz>` to implement `Clone`
9494
note: required by a bound in `Foo2::Bar`
@@ -105,7 +105,7 @@ error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: Clone` is not satisfied
105105
--> $DIR/defaults-suitability.rs:74:23
106106
|
107107
LL | type Bar: Clone = Vec<Self::Baz>;
108-
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz`
108+
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz`, which is required by `Vec<<Self as Foo25<T>>::Baz>: Clone`
109109
|
110110
= note: required for `Vec<<Self as Foo25<T>>::Baz>` to implement `Clone`
111111
note: required by a bound in `Foo25::Bar`

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
22
--> $DIR/hr-associated-type-bound-1.rs:12:14
33
|
44
LL | type U = str;
5-
| ^^^ the trait `Clone` is not implemented for `str`
5+
| ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <i32 as X<'b>>::U: Clone`
66
|
77
= help: the trait `Clone` is implemented for `String`
88
note: required by a bound in `X`

tests/ui/associated-types/hr-associated-type-bound-param-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
22
--> $DIR/hr-associated-type-bound-param-1.rs:14:14
33
|
44
LL | type V = str;
5-
| ^^^ the trait `Clone` is not implemented for `str`
5+
| ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <u8 as Y<'b, u8>>::V: Clone`
66
|
77
= help: the trait `Clone` is implemented for `String`
88
note: required by a bound in `Y`

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
1818
--> $DIR/hr-associated-type-bound-param-2.rs:15:14
1919
|
2020
LL | type W = str;
21-
| ^^^ the trait `Clone` is not implemented for `str`
21+
| ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <u16 as Z<'b, u16>>::W: Clone`
2222
|
2323
= help: the trait `Clone` is implemented for `String`
2424
note: required by a bound in `Z`

tests/ui/associated-types/hr-associated-type-bound-param-3.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
22
--> $DIR/hr-associated-type-bound-param-3.rs:13:14
33
|
44
LL | type U = str;
5-
| ^^^ the trait `Clone` is not implemented for `str`
5+
| ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <(T,) as X<'b, (T,)>>::U: Clone`
66
|
77
= help: the trait `Clone` is implemented for `String`
88
note: required by a bound in `X`

tests/ui/associated-types/hr-associated-type-bound-param-4.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
22
--> $DIR/hr-associated-type-bound-param-4.rs:13:14
33
|
44
LL | type U = str;
5-
| ^^^ the trait `Clone` is not implemented for `str`
5+
| ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <(T,) as X<'b, T>>::U: Clone`
66
|
77
= help: the trait `Clone` is implemented for `String`
88
note: required by a bound in `X`

tests/ui/associated-types/hr-associated-type-bound-param-5.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
22
--> $DIR/hr-associated-type-bound-param-5.rs:26:14
33
|
44
LL | type U = str;
5-
| ^^^ the trait `Clone` is not implemented for `str`
5+
| ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <<Vec<T> as Cycle>::Next as X<'b, <Vec<T> as Cycle>::Next>>::U: Clone`
66
|
77
= help: the trait `Clone` is implemented for `String`
88
note: required by a bound in `X`
@@ -18,7 +18,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
1818
--> $DIR/hr-associated-type-bound-param-5.rs:31:14
1919
|
2020
LL | type U = str;
21-
| ^^^ the trait `Clone` is not implemented for `str`
21+
| ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <<Box<T> as Cycle>::Next as X<'b, <Box<T> as Cycle>::Next>>::U: Clone`
2222
|
2323
= help: the trait `Clone` is implemented for `String`
2424
note: required by a bound in `X`

tests/ui/associated-types/issue-38821.stderr

+16-16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
22
--> $DIR/issue-38821.rs:23:17
33
|
44
LL | #[derive(Debug, Copy, Clone)]
5-
| ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
5+
| ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
66
|
77
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
88
--> $DIR/issue-38821.rs:9:18
@@ -21,7 +21,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
2121
--> $DIR/issue-38821.rs:38:1
2222
|
2323
LL | pub enum ColumnInsertValue<Col, Expr> where
24-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
2525
|
2626
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
2727
--> $DIR/issue-38821.rs:9:18
@@ -45,7 +45,7 @@ LL | | Col: Column,
4545
... |
4646
LL | | Default(Col),
4747
LL | | }
48-
| |_^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
48+
| |_^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
4949
|
5050
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
5151
--> $DIR/issue-38821.rs:9:18
@@ -63,7 +63,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
6363
--> $DIR/issue-38821.rs:23:10
6464
|
6565
LL | #[derive(Debug, Copy, Clone)]
66-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
66+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
6767
|
6868
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
6969
--> $DIR/issue-38821.rs:9:18
@@ -82,7 +82,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
8282
--> $DIR/issue-38821.rs:23:10
8383
|
8484
LL | #[derive(Debug, Copy, Clone)]
85-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
85+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
8686
|
8787
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
8888
--> $DIR/issue-38821.rs:9:18
@@ -102,7 +102,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
102102
--> $DIR/issue-38821.rs:23:10
103103
|
104104
LL | #[derive(Debug, Copy, Clone)]
105-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
105+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
106106
|
107107
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
108108
--> $DIR/issue-38821.rs:9:18
@@ -117,7 +117,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
117117
--> $DIR/issue-38821.rs:23:10
118118
|
119119
LL | #[derive(Debug, Copy, Clone)]
120-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
120+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
121121
|
122122
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
123123
--> $DIR/issue-38821.rs:9:18
@@ -133,7 +133,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
133133
--> $DIR/issue-38821.rs:23:17
134134
|
135135
LL | #[derive(Debug, Copy, Clone)]
136-
| ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
136+
| ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
137137
|
138138
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
139139
--> $DIR/issue-38821.rs:9:18
@@ -153,7 +153,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
153153
--> $DIR/issue-38821.rs:23:23
154154
|
155155
LL | #[derive(Debug, Copy, Clone)]
156-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
156+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
157157
|
158158
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
159159
--> $DIR/issue-38821.rs:9:18
@@ -172,7 +172,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
172172
--> $DIR/issue-38821.rs:23:23
173173
|
174174
LL | #[derive(Debug, Copy, Clone)]
175-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
175+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
176176
|
177177
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
178178
--> $DIR/issue-38821.rs:9:18
@@ -192,7 +192,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
192192
--> $DIR/issue-38821.rs:23:23
193193
|
194194
LL | #[derive(Debug, Copy, Clone)]
195-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
195+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
196196
|
197197
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
198198
--> $DIR/issue-38821.rs:9:18
@@ -207,7 +207,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
207207
--> $DIR/issue-38821.rs:23:23
208208
|
209209
LL | #[derive(Debug, Copy, Clone)]
210-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
210+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
211211
|
212212
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
213213
--> $DIR/issue-38821.rs:9:18
@@ -223,7 +223,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
223223
--> $DIR/issue-38821.rs:23:10
224224
|
225225
LL | #[derive(Debug, Copy, Clone)]
226-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
226+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
227227
|
228228
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
229229
--> $DIR/issue-38821.rs:9:18
@@ -239,7 +239,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
239239
--> $DIR/issue-38821.rs:23:10
240240
|
241241
LL | #[derive(Debug, Copy, Clone)]
242-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
242+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
243243
|
244244
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
245245
--> $DIR/issue-38821.rs:9:18
@@ -255,7 +255,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
255255
--> $DIR/issue-38821.rs:23:23
256256
|
257257
LL | #[derive(Debug, Copy, Clone)]
258-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
258+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
259259
|
260260
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
261261
--> $DIR/issue-38821.rs:9:18
@@ -271,7 +271,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat
271271
--> $DIR/issue-38821.rs:23:23
272272
|
273273
LL | #[derive(Debug, Copy, Clone)]
274-
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
274+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
275275
|
276276
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
277277
--> $DIR/issue-38821.rs:9:18

tests/ui/associated-types/issue-43784-associated-type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied
22
--> $DIR/issue-43784-associated-type.rs:14:18
33
|
44
LL | type Assoc = T;
5-
| ^ the trait `Copy` is not implemented for `T`
5+
| ^ the trait `Copy` is not implemented for `T`, which is required by `<T as Complete>::Assoc: Partial<T>`
66
|
77
note: required for `<T as Complete>::Assoc` to implement `Partial<T>`
88
--> $DIR/issue-43784-associated-type.rs:1:11

tests/ui/associated-types/issue-65774-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied
1515
--> $DIR/issue-65774-1.rs:44:76
1616
|
1717
LL | let closure = |config: &mut <S as MPU>::MpuConfig| writer.my_write(&config);
18-
| ^^^^^^^ the trait `MyDisplay` is not implemented for `T`
18+
| ^^^^^^^ the trait `MyDisplay` is not implemented for `T`, which is required by `&mut T: MyDisplay`
1919
|
2020
= help: the trait `MyDisplay` is implemented for `&'a mut T`
2121
note: required for `&mut T` to implement `MyDisplay`

tests/ui/associated-types/substs-ppaux.normal.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
7676
LL | <str as Foo<u8>>::bar;
7777
| ^^^ doesn't have a size known at compile-time
7878
|
79-
= help: the trait `Sized` is not implemented for `str`
79+
= help: the trait `Sized` is not implemented for `str`, which is required by `str: Foo<'_, '_, u8>`
8080
note: required for `str` to implement `Foo<'_, '_, u8>`
8181
--> $DIR/substs-ppaux.rs:11:17
8282
|

tests/ui/associated-types/substs-ppaux.verbose.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
7676
LL | <str as Foo<u8>>::bar;
7777
| ^^^ doesn't have a size known at compile-time
7878
|
79-
= help: the trait `Sized` is not implemented for `str`
79+
= help: the trait `Sized` is not implemented for `str`, which is required by `str: Foo<'?0, '?1, u8>`
8080
note: required for `str` to implement `Foo<'?0, '?1, u8>`
8181
--> $DIR/substs-ppaux.rs:11:17
8282
|

0 commit comments

Comments
 (0)