Skip to content

Commit a58682d

Browse files
Specify what 'this' actually is
1 parent 8f55d60 commit a58682d

File tree

68 files changed

+193
-187
lines changed

Some content is hidden

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

68 files changed

+193
-187
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2784,7 +2784,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
27842784
_ => true,
27852785
};
27862786
if ident.span.is_visible(sm) && !ident.span.overlaps(span) && !same_line {
2787-
multispan.push_span_label(ident.span, "required by a bound in this");
2787+
multispan.push_span_label(
2788+
ident.span,
2789+
format!(
2790+
"required by a bound in this {}",
2791+
tcx.def_kind(item_def_id).descr(item_def_id)
2792+
),
2793+
);
27882794
}
27892795
}
27902796
let descr = format!("required by a bound in `{item_name}`");

tests/ui/associated-types/associated-types-eq-hr.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ note: required by a bound in `foo`
1515
--> $DIR/associated-types-eq-hr.rs:45:36
1616
|
1717
LL | fn foo<T>()
18-
| --- required by a bound in this
18+
| --- required by a bound in this function
1919
LL | where
2020
LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>,
2121
| ^^^^^^^^^^^^^ required by this bound in `foo`
@@ -37,7 +37,7 @@ note: required by a bound in `bar`
3737
--> $DIR/associated-types-eq-hr.rs:52:36
3838
|
3939
LL | fn bar<T>()
40-
| --- required by a bound in this
40+
| --- required by a bound in this function
4141
LL | where
4242
LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>,
4343
| ^^^^^^^^^^^^^ required by this bound in `bar`

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ LL | Self::Ty: Clone,
2727
| ^^^^^ required by this bound in `Tr2::Ty`
2828
LL | {
2929
LL | type Ty = NotClone;
30-
| -- required by a bound in this
30+
| -- required by a bound in this associated type
3131
help: consider annotating `NotClone` with `#[derive(Clone)]`
3232
|
3333
LL | #[derive(Clone)]
@@ -75,7 +75,7 @@ LL | Self::Assoc: IsU8<Self::Assoc>,
7575
| ^^^^^^^^^^^^^^^^^ required by this bound in `D::Assoc`
7676
...
7777
LL | type Assoc = NotClone;
78-
| ----- required by a bound in this
78+
| ----- required by a bound in this associated type
7979

8080
error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: Clone` is not satisfied
8181
--> $DIR/defaults-suitability.rs:65:23
@@ -124,7 +124,7 @@ LL | Self::Baz: Clone,
124124
| ^^^^^ required by this bound in `Foo3::Baz`
125125
...
126126
LL | type Baz = T;
127-
| --- required by a bound in this
127+
| --- required by a bound in this associated type
128128
help: consider further restricting type parameter `T`
129129
|
130130
LL | Self::Baz: Clone, T: std::clone::Clone

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: required by a bound in `X`
99
--> $DIR/hr-associated-type-bound-1.rs:3:33
1010
|
1111
LL | trait X<'a>
12-
| - required by a bound in this
12+
| - required by a bound in this trait
1313
LL | where
1414
LL | for<'b> <Self as X<'b>>::U: Clone,
1515
| ^^^^^ required by this bound in `X`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ note: required by a bound in `X`
88
--> $DIR/hr-associated-type-bound-object.rs:3:33
99
|
1010
LL | trait X<'a>
11-
| - required by a bound in this
11+
| - required by a bound in this trait
1212
LL | where
1313
LL | for<'b> <Self as X<'b>>::U: Clone,
1414
| ^^^^^ required by this bound in `X`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: required by a bound in `Y`
99
--> $DIR/hr-associated-type-bound-param-1.rs:4:36
1010
|
1111
LL | trait Y<'a, T: ?Sized>
12-
| - required by a bound in this
12+
| - required by a bound in this trait
1313
...
1414
LL | for<'b> <Self as Y<'b, T>>::V: Clone,
1515
| ^^^^^ required by this bound in `Y`

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: required by a bound in `Z`
99
--> $DIR/hr-associated-type-bound-param-2.rs:6:35
1010
|
1111
LL | trait Z<'a, T: ?Sized>
12-
| - required by a bound in this
12+
| - required by a bound in this trait
1313
...
1414
LL | for<'b> <T as Z<'b, u16>>::W: Clone,
1515
| ^^^^^ required by this bound in `Z`
@@ -25,7 +25,7 @@ note: required by a bound in `Z`
2525
--> $DIR/hr-associated-type-bound-param-2.rs:6:35
2626
|
2727
LL | trait Z<'a, T: ?Sized>
28-
| - required by a bound in this
28+
| - required by a bound in this trait
2929
...
3030
LL | for<'b> <T as Z<'b, u16>>::W: Clone,
3131
| ^^^^^ required by this bound in `Z`
@@ -41,7 +41,7 @@ note: required by a bound in `Z`
4141
--> $DIR/hr-associated-type-bound-param-2.rs:6:35
4242
|
4343
LL | trait Z<'a, T: ?Sized>
44-
| - required by a bound in this
44+
| - required by a bound in this trait
4545
...
4646
LL | for<'b> <T as Z<'b, u16>>::W: Clone,
4747
| ^^^^^ required by this bound in `Z`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: required by a bound in `X`
99
--> $DIR/hr-associated-type-bound-param-3.rs:4:33
1010
|
1111
LL | trait X<'a, T>
12-
| - required by a bound in this
12+
| - required by a bound in this trait
1313
...
1414
LL | for<'b> <T as X<'b, T>>::U: Clone,
1515
| ^^^^^ required by this bound in `X`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: required by a bound in `X`
99
--> $DIR/hr-associated-type-bound-param-4.rs:4:36
1010
|
1111
LL | trait X<'a, T>
12-
| - required by a bound in this
12+
| - required by a bound in this trait
1313
...
1414
LL | for<'b> <(T,) as X<'b, T>>::U: Clone,
1515
| ^^^^^ required by this bound in `X`

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: required by a bound in `X`
99
--> $DIR/hr-associated-type-bound-param-5.rs:17:45
1010
|
1111
LL | trait X<'a, T: Cycle + for<'b> X<'b, T>>
12-
| - required by a bound in this
12+
| - required by a bound in this trait
1313
...
1414
LL | for<'b> <T::Next as X<'b, T::Next>>::U: Clone,
1515
| ^^^^^ required by this bound in `X`
@@ -25,7 +25,7 @@ note: required by a bound in `X`
2525
--> $DIR/hr-associated-type-bound-param-5.rs:17:45
2626
|
2727
LL | trait X<'a, T: Cycle + for<'b> X<'b, T>>
28-
| - required by a bound in this
28+
| - required by a bound in this trait
2929
...
3030
LL | for<'b> <T::Next as X<'b, T::Next>>::U: Clone,
3131
| ^^^^^ required by this bound in `X`

0 commit comments

Comments
 (0)