restore spans for issue-50480
This commit is contained in:
parent
8ba74369c2
commit
ee98dc8b3b
3 changed files with 30 additions and 19 deletions
|
|
@ -50,8 +50,21 @@ pub fn can_type_implement_copy<'tcx>(
|
|||
continue;
|
||||
}
|
||||
let span = tcx.def_span(field.did);
|
||||
// FIXME(compiler-errors): This gives us better spans for bad
|
||||
// projection types like in issue-50480.
|
||||
// If the ADT has substs, point to the cause we are given.
|
||||
// If it does not, then this field probably doesn't normalize
|
||||
// to begin with, and point to the bad field's span instead.
|
||||
let cause = if field
|
||||
.ty(tcx, traits::InternalSubsts::identity_for_item(tcx, adt.did))
|
||||
.has_param_types_or_consts()
|
||||
{
|
||||
cause.clone()
|
||||
} else {
|
||||
ObligationCause::dummy_with_span(span)
|
||||
};
|
||||
let ctx = traits::FulfillmentContext::new();
|
||||
match traits::fully_normalize(&infcx, ctx, cause.clone(), param_env, ty) {
|
||||
match traits::fully_normalize(&infcx, ctx, cause, param_env, ty) {
|
||||
Ok(ty) => {
|
||||
if !infcx.type_is_copy_modulo_regions(param_env, ty, span) {
|
||||
infringing.push(field);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
#[derive(Clone, Copy)]
|
||||
//~^ ERROR the trait `Copy` may not be implemented for this type
|
||||
//~| ERROR `i32` is not an iterator
|
||||
struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
//~^ ERROR cannot find type `NotDefined` in this scope
|
||||
//~| ERROR cannot find type `NotDefined` in this scope
|
||||
//~| ERROR cannot find type `N` in this scope
|
||||
//~| ERROR cannot find type `N` in this scope
|
||||
//~| ERROR `i32` is not an iterator
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
//~^ ERROR the trait `Copy` may not be implemented for this type
|
||||
//~| ERROR `i32` is not an iterator
|
||||
struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
//~^ ERROR cannot find type `NotDefined` in this scope
|
||||
//~| ERROR cannot find type `N` in this scope
|
||||
//~| ERROR `i32` is not an iterator
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0412]: cannot find type `N` in this scope
|
||||
--> $DIR/issue-50480.rs:4:12
|
||||
--> $DIR/issue-50480.rs:3:12
|
||||
|
|
||||
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| -^ not found in this scope
|
||||
|
|
@ -7,13 +7,13 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
|||
| help: you might be missing a type parameter: `<N>`
|
||||
|
||||
error[E0412]: cannot find type `NotDefined` in this scope
|
||||
--> $DIR/issue-50480.rs:4:15
|
||||
--> $DIR/issue-50480.rs:3:15
|
||||
|
|
||||
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| ^^^^^^^^^^ not found in this scope
|
||||
|
||||
error[E0412]: cannot find type `N` in this scope
|
||||
--> $DIR/issue-50480.rs:4:12
|
||||
--> $DIR/issue-50480.rs:3:12
|
||||
|
|
||||
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| -^ not found in this scope
|
||||
|
|
@ -21,7 +21,7 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
|||
| help: you might be missing a type parameter: `<N>`
|
||||
|
||||
error[E0412]: cannot find type `NotDefined` in this scope
|
||||
--> $DIR/issue-50480.rs:4:15
|
||||
--> $DIR/issue-50480.rs:3:15
|
||||
|
|
||||
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| - ^^^^^^^^^^ not found in this scope
|
||||
|
|
@ -29,7 +29,7 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
|||
| help: you might be missing a type parameter: `<NotDefined>`
|
||||
|
||||
error[E0412]: cannot find type `N` in this scope
|
||||
--> $DIR/issue-50480.rs:13:18
|
||||
--> $DIR/issue-50480.rs:12:18
|
||||
|
|
||||
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| - ^
|
||||
|
|
@ -46,27 +46,26 @@ LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, Strin
|
|||
| +++
|
||||
|
||||
error[E0412]: cannot find type `NotDefined` in this scope
|
||||
--> $DIR/issue-50480.rs:13:21
|
||||
--> $DIR/issue-50480.rs:12:21
|
||||
|
|
||||
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| ^^^^^^^^^^ not found in this scope
|
||||
|
||||
error[E0277]: `i32` is not an iterator
|
||||
--> $DIR/issue-50480.rs:1:17
|
||||
--> $DIR/issue-50480.rs:3:27
|
||||
|
|
||||
LL | #[derive(Clone, Copy)]
|
||||
| ^^^^ `i32` is not an iterator
|
||||
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `i32`
|
||||
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0204]: the trait `Copy` may not be implemented for this type
|
||||
--> $DIR/issue-50480.rs:1:17
|
||||
|
|
||||
LL | #[derive(Clone, Copy)]
|
||||
| ^^^^
|
||||
...
|
||||
LL |
|
||||
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| -------- ------ this field does not implement `Copy`
|
||||
| |
|
||||
|
|
@ -75,21 +74,20 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
|||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `i32` is not an iterator
|
||||
--> $DIR/issue-50480.rs:10:17
|
||||
--> $DIR/issue-50480.rs:12:33
|
||||
|
|
||||
LL | #[derive(Clone, Copy)]
|
||||
| ^^^^ `i32` is not an iterator
|
||||
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `i32`
|
||||
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0204]: the trait `Copy` may not be implemented for this type
|
||||
--> $DIR/issue-50480.rs:10:17
|
||||
|
|
||||
LL | #[derive(Clone, Copy)]
|
||||
| ^^^^
|
||||
...
|
||||
LL |
|
||||
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||
| -------- ------ this field does not implement `Copy`
|
||||
| |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue