rust/tests/ui/unsafe-fields/unsafe-fields-parse.stderr
Jack Wrenn a122dde217 do not implement unsafe auto traits for types with unsafe fields
If a type has unsafe fields, its safety invariants are not simply
the conjunction of its field types' safety invariants. Consequently,
it's invalid to reason about the safety properties of these types
in a purely structural manner — i.e., the manner in which `auto`
traits are implemented.

Makes progress towards #132922.
2024-12-05 23:52:21 +00:00

18 lines
537 B
Text

error: expected type, found keyword `unsafe`
--> $DIR/unsafe-fields-parse.rs:7:15
|
LL | enum A {
| - while parsing this enum
LL | TupleLike(unsafe u32),
| ^^^^^^ expected type
|
= help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`
error: expected type, found keyword `unsafe`
--> $DIR/unsafe-fields-parse.rs:10:10
|
LL | struct B(unsafe u32);
| ^^^^^^ expected type
error: aborting due to 2 previous errors