rust/tests/ui/unsafe-fields/auto-traits.next.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

17 lines
665 B
Text

error[E0277]: the trait bound `UnsafeEnum: UnsafeAuto` is not satisfied
--> $DIR/auto-traits.rs:24:22
|
LL | impl_unsafe_auto(UnsafeEnum::Safe(42));
| ---------------- ^^^^^^^^^^^^^^^^^^^^ the trait `UnsafeAuto` is not implemented for `UnsafeEnum`
| |
| required by a bound introduced by this call
|
note: required by a bound in `impl_unsafe_auto`
--> $DIR/auto-traits.rs:20:29
|
LL | fn impl_unsafe_auto(_: impl UnsafeAuto) {}
| ^^^^^^^^^^ required by this bound in `impl_unsafe_auto`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.