mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
New ui tests for new soft feature gates
This commit is contained in:
parent
767239f740
commit
944c6b6d76
30
src/test/ui/feature-gates/soft-syntax-gates-with-errors.rs
Normal file
30
src/test/ui/feature-gates/soft-syntax-gates-with-errors.rs
Normal file
@ -0,0 +1,30 @@
|
||||
// check-fail
|
||||
// This file is used to test the behavior of the early-pass syntax warnings.
|
||||
// If macro syntax is stabilized, replace with a different unstable syntax.
|
||||
|
||||
macro a() {}
|
||||
//~^ ERROR: `macro` is experimental
|
||||
|
||||
#[cfg(FALSE)]
|
||||
macro b() {}
|
||||
|
||||
macro_rules! identity {
|
||||
($($x:tt)*) => ($($x)*);
|
||||
}
|
||||
|
||||
identity! {
|
||||
macro c() {}
|
||||
//~^ ERROR: `macro` is experimental
|
||||
}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
identity! {
|
||||
macro d() {} // No error
|
||||
}
|
||||
|
||||
identity! {
|
||||
#[cfg(FALSE)]
|
||||
macro e() {}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,21 @@
|
||||
error[E0658]: `macro` is experimental
|
||||
--> $DIR/soft-syntax-gates-with-errors.rs:5:1
|
||||
|
|
||||
LL | macro a() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #39412 <https://github.com/rust-lang/rust/issues/39412> for more information
|
||||
= help: add `#![feature(decl_macro)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: `macro` is experimental
|
||||
--> $DIR/soft-syntax-gates-with-errors.rs:16:5
|
||||
|
|
||||
LL | macro c() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #39412 <https://github.com/rust-lang/rust/issues/39412> for more information
|
||||
= help: add `#![feature(decl_macro)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -0,0 +1,26 @@
|
||||
// check-pass
|
||||
// This file is used to test the behavior of the early-pass syntax warnings.
|
||||
// If macro syntax is stabilized, replace with a different unstable syntax.
|
||||
|
||||
#[cfg(FALSE)]
|
||||
macro b() {}
|
||||
//~^ WARN: `macro` is experimental
|
||||
//~| WARN: unstable syntax
|
||||
|
||||
macro_rules! identity {
|
||||
($($x:tt)*) => ($($x)*);
|
||||
}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
identity! {
|
||||
macro d() {} // No error
|
||||
}
|
||||
|
||||
identity! {
|
||||
#[cfg(FALSE)]
|
||||
macro e() {}
|
||||
//~^ WARN: `macro` is experimental
|
||||
//~| WARN: unstable syntax
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,24 @@
|
||||
warning: `macro` is experimental
|
||||
--> $DIR/soft-syntax-gates-without-errors.rs:6:1
|
||||
|
|
||||
LL | macro b() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #39412 <https://github.com/rust-lang/rust/issues/39412> for more information
|
||||
= help: add `#![feature(decl_macro)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: `macro` is experimental
|
||||
--> $DIR/soft-syntax-gates-without-errors.rs:21:5
|
||||
|
|
||||
LL | macro e() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #39412 <https://github.com/rust-lang/rust/issues/39412> for more information
|
||||
= help: add `#![feature(decl_macro)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
4
src/test/ui/suggestions/many-type-ascription.rs
Normal file
4
src/test/ui/suggestions/many-type-ascription.rs
Normal file
@ -0,0 +1,4 @@
|
||||
fn main() {
|
||||
let _ = 0: i32; //~ ERROR: type ascription is experimental
|
||||
let _ = 0: i32; // (error only emitted once)
|
||||
}
|
12
src/test/ui/suggestions/many-type-ascription.stderr
Normal file
12
src/test/ui/suggestions/many-type-ascription.stderr
Normal file
@ -0,0 +1,12 @@
|
||||
error[E0658]: type ascription is experimental
|
||||
--> $DIR/many-type-ascription.rs:2:13
|
||||
|
|
||||
LL | let _ = 0: i32;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
|
||||
= help: add `#![feature(type_ascription)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -0,0 +1,6 @@
|
||||
fn main() {
|
||||
not rust; //~ ERROR
|
||||
let _ = 0: i32; // (error hidden by existing error)
|
||||
#[cfg(FALSE)]
|
||||
let _ = 0: i32; // (warning hidden by existing error)
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `rust`
|
||||
--> $DIR/type-ascription-and-other-error.rs:2:9
|
||||
|
|
||||
LL | not rust;
|
||||
| ^^^^ expected one of 8 possible tokens
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user