diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-02-01 14:57:01 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-02-01 20:01:05 +0100 |
| commit | 0f21e45e95ea879ec13a690390c9d0bd327bfe58 (patch) | |
| tree | 67af1bb765cdff9b06ae745a9e26b805b6637dd0 | |
| parent | 2c0030ff2cb373a31d4dfa7f7cb3596739090ff3 (diff) | |
| download | rust-0f21e45e95ea879ec13a690390c9d0bd327bfe58.tar.gz rust-0f21e45e95ea879ec13a690390c9d0bd327bfe58.zip | |
Update `never_type` feature gate ui test
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-never_type.rs | 9 | ||||
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-never_type.stderr | 32 | ||||
| -rw-r--r-- | tests/ui/never_type/never-type-in-nested-fn-decl.rs | 7 |
3 files changed, 47 insertions, 1 deletions
diff --git a/tests/ui/feature-gates/feature-gate-never_type.rs b/tests/ui/feature-gates/feature-gate-never_type.rs index be8c27dbb1b..f5d28a4877f 100644 --- a/tests/ui/feature-gates/feature-gate-never_type.rs +++ b/tests/ui/feature-gates/feature-gate-never_type.rs @@ -13,5 +13,14 @@ impl Foo for Meeshka { type Wub = !; //~ ERROR type is experimental } +fn look_ma_no_feature_gate<F: FnOnce() -> !>() {} //~ ERROR type is experimental +fn tadam(f: &dyn Fn() -> !) {} //~ ERROR type is experimental +fn panic() -> ! { + panic!(); +} +fn toudoum() -> impl Fn() -> ! { //~ ERROR type is experimental + panic +} + fn main() { } diff --git a/tests/ui/feature-gates/feature-gate-never_type.stderr b/tests/ui/feature-gates/feature-gate-never_type.stderr index 0fca58519ce..33e4e019b18 100644 --- a/tests/ui/feature-gates/feature-gate-never_type.stderr +++ b/tests/ui/feature-gates/feature-gate-never_type.stderr @@ -48,6 +48,36 @@ LL | type Wub = !; = help: add `#![feature(never_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 5 previous errors +error[E0658]: the `!` type is experimental + --> $DIR/feature-gate-never_type.rs:16:43 + | +LL | fn look_ma_no_feature_gate<F: FnOnce() -> !>() {} + | ^ + | + = note: see issue #35121 <https://github.com/rust-lang/rust/issues/35121> for more information + = help: add `#![feature(never_type)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: the `!` type is experimental + --> $DIR/feature-gate-never_type.rs:17:26 + | +LL | fn tadam(f: &dyn Fn() -> !) {} + | ^ + | + = note: see issue #35121 <https://github.com/rust-lang/rust/issues/35121> for more information + = help: add `#![feature(never_type)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: the `!` type is experimental + --> $DIR/feature-gate-never_type.rs:21:30 + | +LL | fn toudoum() -> impl Fn() -> ! { + | ^ + | + = note: see issue #35121 <https://github.com/rust-lang/rust/issues/35121> for more information + = help: add `#![feature(never_type)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/never_type/never-type-in-nested-fn-decl.rs b/tests/ui/never_type/never-type-in-nested-fn-decl.rs new file mode 100644 index 00000000000..df546c4717e --- /dev/null +++ b/tests/ui/never_type/never-type-in-nested-fn-decl.rs @@ -0,0 +1,7 @@ +// build-pass + +trait X<const N: i32> {} + +fn hello<T: X<{ fn hello() -> ! { loop {} } 1 }>>() {} + +fn main() {} |
