mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-18 10:38:11 +00:00
26 lines
588 B
Rust
26 lines
588 B
Rust
![]() |
//@ compile-flags: --crate-type=lib
|
||
|
//@ revisions: with_gate without_gate
|
||
|
//@ [with_gate] check-pass
|
||
|
|
||
|
#![cfg_attr(with_gate, feature(unsafe_fields))] //[with_gate]~ WARNING
|
||
|
|
||
|
#[cfg(any())]
|
||
|
struct Foo {
|
||
|
unsafe field: (), //[without_gate]~ ERROR
|
||
|
}
|
||
|
|
||
|
// This should not parse as an unsafe field definition.
|
||
|
struct FooTuple(unsafe fn());
|
||
|
|
||
|
#[cfg(any())]
|
||
|
enum Bar {
|
||
|
Variant { unsafe field: () }, //[without_gate]~ ERROR
|
||
|
// This should not parse as an unsafe field definition.
|
||
|
VariantTuple(unsafe fn()),
|
||
|
}
|
||
|
|
||
|
#[cfg(any())]
|
||
|
union Baz {
|
||
|
unsafe field: (), //[without_gate]~ ERROR
|
||
|
}
|