Skip to content

Commit c85ccdb

Browse files
committed
Revert span for "impl assoc type has extra requirements"
1 parent 6a5b476 commit c85ccdb

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

compiler/rustc_typeck/src/check/compare_method.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,8 @@ crate fn compare_ty_impl<'tcx>(
10531053
let _: Result<(), ErrorReported> = (|| {
10541054
compare_number_of_generics(tcx, impl_ty, impl_ty_span, trait_ty, trait_item_span)?;
10551055

1056-
compare_type_predicate_entailment(tcx, impl_ty, impl_ty_span, trait_ty, impl_trait_ref)?;
1056+
let sp = tcx.def_span(impl_ty.def_id);
1057+
compare_type_predicate_entailment(tcx, impl_ty, sp, trait_ty, impl_trait_ref)?;
10571058

10581059
check_type_bounds(tcx, trait_ty, impl_ty, impl_ty_span, impl_trait_ref)
10591060
})();

src/test/ui/generic-associated-types/generic-associated-types-where.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ LL | type Assoc2<T: std::fmt::Display> = Vec<T>;
1111
| ^^^^^^^^^^^^^^^^^^^
1212

1313
error[E0276]: impl has stricter requirements than trait
14-
--> $DIR/generic-associated-types-where.rs:23:40
14+
--> $DIR/generic-associated-types-where.rs:23:5
1515
|
1616
LL | type Assoc3<T>;
1717
| --------------- definition of `Assoc3` from trait
1818
...
1919
LL | type Assoc3<T> where T: Iterator = Vec<T>;
20-
| ^^^^^^ impl has extra requirement `T: Iterator`
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator`
2121

2222
error: aborting due to 2 previous errors
2323

src/test/ui/generic-associated-types/impl_bounds.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0310]: the parameter type `T` may not live long enough
2-
--> $DIR/impl_bounds.rs:16:39
2+
--> $DIR/impl_bounds.rs:16:5
33
|
44
LL | type A<'a> where Self: 'static = (&'a ());
5-
| ^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: consider adding an explicit lifetime bound `T: 'static`...
88
= note: ...so that the type `Fooy<T>` will meet its required lifetime bounds
99

1010
error[E0478]: lifetime bound not satisfied
11-
--> $DIR/impl_bounds.rs:18:35
11+
--> $DIR/impl_bounds.rs:18:5
1212
|
1313
LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
14-
| ^^^^^^^^^^^^^^^
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515
|
1616
note: lifetime parameter instantiated with the lifetime `'b` as defined on the associated item at 18:16
1717
--> $DIR/impl_bounds.rs:18:16
@@ -42,10 +42,10 @@ LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
4242
| ^^
4343

4444
error[E0277]: the trait bound `T: Copy` is not satisfied
45-
--> $DIR/impl_bounds.rs:21:31
45+
--> $DIR/impl_bounds.rs:21:5
4646
|
4747
LL | type C where Self: Copy = String;
48-
| ^^^^^^ the trait `Copy` is not implemented for `T`
48+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
4949
|
5050
= note: required because of the requirements on the impl of `Copy` for `Fooy<T>`
5151
note: the requirement `Fooy<T>: Copy` appears on the associated impl type `C` but not on the corresponding associated trait type

src/test/ui/generic-associated-types/issue-47206-where-clause.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0276]: impl has stricter requirements than trait
2-
--> $DIR/issue-47206-where-clause.rs:13:40
2+
--> $DIR/issue-47206-where-clause.rs:13:5
33
|
44
LL | type Assoc3<T>;
55
| --------------- definition of `Assoc3` from trait
66
...
77
LL | type Assoc3<T> where T: Iterator = Vec<T>;
8-
| ^^^^^^ impl has extra requirement `T: Iterator`
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator`
99

1010
error: aborting due to previous error
1111

0 commit comments

Comments
 (0)