mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Don't report E0740 for type error
This commit is contained in:
parent
38b9655311
commit
08e5a77b06
@ -114,9 +114,11 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
|
||||
allowed_union_field(*elem, tcx, param_env)
|
||||
}
|
||||
_ => {
|
||||
// Fallback case: allow `ManuallyDrop` and things that are `Copy`.
|
||||
// Fallback case: allow `ManuallyDrop` and things that are `Copy`,
|
||||
// also no need to report an error if the type is unresolved.
|
||||
ty.ty_adt_def().is_some_and(|adt_def| adt_def.is_manually_drop())
|
||||
|| ty.is_copy_modulo_regions(tcx, param_env)
|
||||
|| ty.references_error()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
8
tests/ui/union/unresolved-field-isnt-copy.rs
Normal file
8
tests/ui/union/unresolved-field-isnt-copy.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// Unresolved fields are not copy, but also shouldn't report an extra E0740.
|
||||
|
||||
pub union Foo {
|
||||
x: *const Missing,
|
||||
//~^ ERROR cannot find type `Missing` in this scope
|
||||
}
|
||||
|
||||
fn main() {}
|
9
tests/ui/union/unresolved-field-isnt-copy.stderr
Normal file
9
tests/ui/union/unresolved-field-isnt-copy.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0412]: cannot find type `Missing` in this scope
|
||||
--> $DIR/unresolved-field-isnt-copy.rs:4:15
|
||||
|
|
||||
LL | x: *const Missing,
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
Loading…
Reference in New Issue
Block a user