also test non-extern uninhabited statics
This commit is contained in:
parent
5d624929cf
commit
3bd5cc900c
|
@ -9,4 +9,9 @@ extern {
|
|||
//~| WARN: previously accepted
|
||||
}
|
||||
|
||||
static VOID2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type
|
||||
//~| WARN: previously accepted
|
||||
static NEVER2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type
|
||||
//~| WARN: previously accepted
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -23,5 +23,25 @@ LL | static NEVER: !;
|
|||
= note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
|
||||
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: static of uninhabited type
|
||||
--> $DIR/uninhabited-static.rs:12:1
|
||||
|
|
||||
LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
|
||||
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
|
||||
|
||||
error: static of uninhabited type
|
||||
--> $DIR/uninhabited-static.rs:14:1
|
||||
|
|
||||
LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
|
||||
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
Loading…
Reference in New Issue