diff options
| author | Ralf Jung <post@ralfj.de> | 2022-09-25 22:56:01 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-09-26 09:44:10 +0200 |
| commit | c19daa472b69fdcbbb15402e8d1e8e05bae39f38 (patch) | |
| tree | fc592cc8e6edd8569da64bb5ee112d7d79724a58 /src/test/ui/statics | |
| parent | f3fafbb006ee98635874f73e480655912b465e65 (diff) | |
| download | rust-c19daa472b69fdcbbb15402e8d1e8e05bae39f38.tar.gz rust-c19daa472b69fdcbbb15402e8d1e8e05bae39f38.zip | |
make invalid_value lint a bit smarter around enums
Diffstat (limited to 'src/test/ui/statics')
| -rw-r--r-- | src/test/ui/statics/uninhabited-static.stderr | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/test/ui/statics/uninhabited-static.stderr b/src/test/ui/statics/uninhabited-static.stderr index 88ee4cbdc2e..6d37de8ff3f 100644 --- a/src/test/ui/statics/uninhabited-static.stderr +++ b/src/test/ui/statics/uninhabited-static.stderr @@ -59,7 +59,11 @@ LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | = note: `#[warn(invalid_value)]` on by default - = note: enums with no variants have no valid value +note: enums with no inhabited variants have no valid value + --> $DIR/uninhabited-static.rs:4:1 + | +LL | enum Void {} + | ^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $DIR/uninhabited-static.rs:16:32 @@ -76,7 +80,11 @@ LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; | this code causes undefined behavior when executed | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | - = note: enums with no variants have no valid value +note: enums with no inhabited variants have no valid value + --> $DIR/uninhabited-static.rs:4:1 + | +LL | enum Void {} + | ^^^^^^^^^ error: aborting due to 6 previous errors; 2 warnings emitted |
