rust/src/test/compile-fail/union
Mark Rousskov 7897ee4d42
Rollup merge of #52207 - RalfJung:unsafety-errors, r=estebank
improve error message shown for unsafe operations

Add a short explanation saying why undefined behavior could arise. In particular, the error many people got for "creating a pointer to a packed field requires unsafe block" was not worded great -- it lead to people just adding the unsafe block without considering if what they are doing follows the rules.

I am not sure if a "note" is the right thing, but that was the easiest thing to add...

Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673
2018-07-11 12:38:36 -06:00
..
union-borrow-move-parent-sibling.rs Fix move checking for nested union fields 2017-04-08 11:52:37 +03:00
union-const-pat.rs Stabilize unions with Copy fields and no destructor 2017-05-27 00:52:20 +03:00
union-copy.rs Improve shallow Clone deriving 2016-09-10 18:43:27 +03:00
union-derive-clone.rs Improve shallow Clone deriving 2016-09-10 18:43:27 +03:00
union-derive.rs Stabilize unions with Copy fields and no destructor 2017-05-27 00:52:20 +03:00
union-empty.rs Stabilize unions with Copy fields and no destructor 2017-05-27 00:52:20 +03:00
union-generic.rs Stabilize unions with Copy fields and no destructor 2017-05-27 00:52:20 +03:00
union-lint-dead-code.rs Stabilize unions with Copy fields and no destructor 2017-05-27 00:52:20 +03:00
union-nonrepresentable.rs
union-repr-c.rs [improper_ctypes] Overhaul primary label 2018-02-15 18:10:54 +01:00
union-unsafe.rs improve error message shown for unsafe operations: explain why undefined behavior could arise 2018-07-10 11:01:44 +02:00
union-unsized.rs Fix typo in error message E0277 2018-07-10 23:10:13 +02:00
union-with-drop-fields-lint.rs