Add feature gate
This commit is contained in:
parent
5eb29c7f49
commit
83b4df4e61
8 changed files with 29 additions and 4 deletions
7
tests/ui/feature-gates/feature-gate-builtin_syntax.rs
Normal file
7
tests/ui/feature-gates/feature-gate-builtin_syntax.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
struct Foo {
|
||||
v: u8,
|
||||
w: u8,
|
||||
}
|
||||
fn main() {
|
||||
builtin # offset_of(Foo, v); //~ ERROR `builtin #` syntax is unstable
|
||||
}
|
||||
12
tests/ui/feature-gates/feature-gate-builtin_syntax.stderr
Normal file
12
tests/ui/feature-gates/feature-gate-builtin_syntax.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0658]: `builtin #` syntax is unstable
|
||||
--> $DIR/feature-gate-builtin_syntax.rs:6:15
|
||||
|
|
||||
LL | builtin # offset_of(Foo, v);
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #110680 <https://github.com/rust-lang/rust/issues/110680> for more information
|
||||
= help: add `#![feature(builtin_syntax)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#![feature(builtin_syntax)]
|
||||
|
||||
// For the exposed macro we already test these errors in the other files,
|
||||
// but this test helps to make sure the builtin construct also errors.
|
||||
// This has the same examples as offset-of-arg-count.rs
|
||||
|
||||
|
||||
|
||||
fn main() {
|
||||
builtin # offset_of(NotEnoughArguments); //~ ERROR expected one of
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![feature(builtin_syntax)]
|
||||
|
||||
fn main() {
|
||||
builtin # foobar(); //~ ERROR unknown `builtin #` construct
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error: unknown `builtin #` construct `foobar`
|
||||
--> $DIR/builtin-syntax.rs:2:5
|
||||
--> $DIR/builtin-syntax.rs:4:5
|
||||
|
|
||||
LL | builtin # foobar();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected identifier after `builtin #`
|
||||
--> $DIR/builtin-syntax.rs:6:15
|
||||
--> $DIR/builtin-syntax.rs:8:15
|
||||
|
|
||||
LL | builtin # {}();
|
||||
| ^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue