summaryrefslogtreecommitdiffstats
path: root/tests/ui/feature-gates
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/feature-gates')
-rw-r--r--tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs9
-rw-r--r--tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr21
-rw-r--r--tests/ui/feature-gates/feature-gate-generic_arg_infer.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.cfg_current.stderr27
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.cfg_next.stderr27
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.no_current.stderr13
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.no_next.stderr13
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.rs24
-rw-r--r--tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs7
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.rs12
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr93
11 files changed, 235 insertions, 13 deletions
diff --git a/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs
new file mode 100644
index 000000000..856a7f393
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs
@@ -0,0 +1,9 @@
+pub fn you<T>() -> T {
+ become bottom(); //~ error: `become` expression is experimental
+}
+
+pub fn bottom<T>() -> T {
+ become you(); //~ error: `become` expression is experimental
+}
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr
new file mode 100644
index 000000000..b58da19c1
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr
@@ -0,0 +1,21 @@
+error[E0658]: `become` expression is experimental
+ --> $DIR/feature-gate-explicit_tail_calls.rs:2:5
+ |
+LL | become bottom();
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #112788 <https://github.com/rust-lang/rust/issues/112788> for more information
+ = help: add `#![feature(explicit_tail_calls)]` to the crate attributes to enable
+
+error[E0658]: `become` expression is experimental
+ --> $DIR/feature-gate-explicit_tail_calls.rs:6:5
+ |
+LL | become you();
+ | ^^^^^^^^^^^^
+ |
+ = note: see issue #112788 <https://github.com/rust-lang/rust/issues/112788> for more information
+ = help: add `#![feature(explicit_tail_calls)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-generic_arg_infer.rs b/tests/ui/feature-gates/feature-gate-generic_arg_infer.rs
index afd14b784..be66560fd 100644
--- a/tests/ui/feature-gates/feature-gate-generic_arg_infer.rs
+++ b/tests/ui/feature-gates/feature-gate-generic_arg_infer.rs
@@ -19,5 +19,5 @@ fn bar() {
fn main() {
let _x = foo::<_>([1,2]);
//[normal]~^ ERROR: type provided when a constant was expected
- let _y = bar();
+ bar();
}
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_current.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_current.stderr
new file mode 100644
index 000000000..ce39f6b29
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_current.stderr
@@ -0,0 +1,27 @@
+error[E0658]: return type notation is experimental
+ --> $DIR/feature-gate-return_type_notation.rs:17:17
+ |
+LL | fn foo<T: Trait<m(): Send>>() {}
+ | ^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = help: add `#![feature(return_type_notation)]` to the crate attributes to enable
+
+error: parenthesized generic arguments cannot be used in associated type constraints
+ --> $DIR/feature-gate-return_type_notation.rs:17:17
+ |
+LL | fn foo<T: Trait<m(): Send>>() {}
+ | ^--
+ | |
+ | help: remove these parentheses
+
+error[E0220]: associated type `m` not found for `Trait`
+ --> $DIR/feature-gate-return_type_notation.rs:17:17
+ |
+LL | fn foo<T: Trait<m(): Send>>() {}
+ | ^ associated type `m` not found
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0220, E0658.
+For more information about an error, try `rustc --explain E0220`.
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_next.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_next.stderr
new file mode 100644
index 000000000..ce39f6b29
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_next.stderr
@@ -0,0 +1,27 @@
+error[E0658]: return type notation is experimental
+ --> $DIR/feature-gate-return_type_notation.rs:17:17
+ |
+LL | fn foo<T: Trait<m(): Send>>() {}
+ | ^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = help: add `#![feature(return_type_notation)]` to the crate attributes to enable
+
+error: parenthesized generic arguments cannot be used in associated type constraints
+ --> $DIR/feature-gate-return_type_notation.rs:17:17
+ |
+LL | fn foo<T: Trait<m(): Send>>() {}
+ | ^--
+ | |
+ | help: remove these parentheses
+
+error[E0220]: associated type `m` not found for `Trait`
+ --> $DIR/feature-gate-return_type_notation.rs:17:17
+ |
+LL | fn foo<T: Trait<m(): Send>>() {}
+ | ^ associated type `m` not found
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0220, E0658.
+For more information about an error, try `rustc --explain E0220`.
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.no_current.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.no_current.stderr
new file mode 100644
index 000000000..d11359e7f
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.no_current.stderr
@@ -0,0 +1,13 @@
+warning: return type notation is experimental
+ --> $DIR/feature-gate-return_type_notation.rs:17:17
+ |
+LL | fn foo<T: Trait<m(): Send>>() {}
+ | ^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = help: add `#![feature(return_type_notation)]` 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: 1 warning emitted
+
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.no_next.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.no_next.stderr
new file mode 100644
index 000000000..d11359e7f
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.no_next.stderr
@@ -0,0 +1,13 @@
+warning: return type notation is experimental
+ --> $DIR/feature-gate-return_type_notation.rs:17:17
+ |
+LL | fn foo<T: Trait<m(): Send>>() {}
+ | ^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = help: add `#![feature(return_type_notation)]` 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: 1 warning emitted
+
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.rs b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
index d9bcb65fe..7e8c1eb95 100644
--- a/tests/ui/feature-gates/feature-gate-return_type_notation.rs
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
@@ -1,7 +1,10 @@
// edition: 2021
-// revisions: cfg no
+// revisions: cfg_current cfg_next no_current no_next
+// [cfg_next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// [no_next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-//[no] check-pass
+// [no_current] check-pass
+// [no_next] check-pass
// Since we're not adding new syntax, `cfg`'d out RTN must pass.
#![feature(async_fn_in_trait)]
@@ -10,12 +13,17 @@ trait Trait {
async fn m();
}
-#[cfg(cfg)]
+#[cfg(any(cfg_current, cfg_next))]
fn foo<T: Trait<m(): Send>>() {}
-//[cfg]~^ ERROR return type notation is experimental
-//[cfg]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
-//[cfg]~| ERROR associated type `m` not found for `Trait`
-//[no]~^^^^ WARN return type notation is experimental
-//[no]~| WARN unstable syntax can change at any point in the future, causing a hard error!
+//[cfg_current]~^ ERROR return type notation is experimental
+//[cfg_current]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
+//[cfg_current]~| ERROR associated type `m` not found for `Trait`
+//[cfg_next]~^^^^ ERROR return type notation is experimental
+//[cfg_next]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
+//[cfg_next]~| ERROR associated type `m` not found for `Trait`
+//[no_current]~^^^^^^^ WARN return type notation is experimental
+//[no_current]~| WARN unstable syntax can change at any point in the future, causing a hard error!
+//[no_next]~^^^^^^^^^ WARN return type notation is experimental
+//[no_next]~| WARN unstable syntax can change at any point in the future, causing a hard error!
fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs b/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
index 6dfd7f684..3f49020bb 100644
--- a/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
+++ b/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
@@ -1,4 +1,3 @@
-// ignore-compare-mode-chalk
// check-pass
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
@@ -12,7 +11,7 @@ fn define() -> Bar {
type Foo2 = impl Debug;
-fn define2() {
+fn define2(_: Foo2) {
let x = || -> Foo2 { 42 };
}
@@ -21,13 +20,13 @@ type Foo3 = impl Debug;
fn define3(x: Foo3) {
let y: i32 = x;
}
-fn define3_1() {
+fn define3_1(_: Foo3) {
define3(42)
}
type Foo4 = impl Debug;
-fn define4() {
+fn define4(_: Foo4) {
let y: Foo4 = 42;
}
diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
new file mode 100644
index 000000000..aad64c9d0
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
@@ -0,0 +1,12 @@
+// check-pass
+
+#![warn(private_interfaces)] //~ WARN unknown lint
+ //~| WARN unknown lint
+ //~| WARN unknown lint
+#![warn(private_bounds)] //~ WARN unknown lint
+ //~| WARN unknown lint
+ //~| WARN unknown lint
+#![warn(unnameable_types)] //~ WARN unknown lint
+ //~| WARN unknown lint
+ //~| WARN unknown lint
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
new file mode 100644
index 000000000..79cc974cc
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
@@ -0,0 +1,93 @@
+warning: unknown lint: `private_interfaces`
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
+ |
+LL | #![warn(private_interfaces)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `private_interfaces` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+ = note: `#[warn(unknown_lints)]` on by default
+
+warning: unknown lint: `private_bounds`
+ --> $DIR/feature-gate-type_privacy_lints.rs:6:1
+ |
+LL | #![warn(private_bounds)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `private_bounds` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+
+warning: unknown lint: `unnameable_types`
+ --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ |
+LL | #![warn(unnameable_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `unnameable_types` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+
+warning: unknown lint: `private_interfaces`
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
+ |
+LL | #![warn(private_interfaces)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `private_interfaces` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+
+warning: unknown lint: `private_bounds`
+ --> $DIR/feature-gate-type_privacy_lints.rs:6:1
+ |
+LL | #![warn(private_bounds)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `private_bounds` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+
+warning: unknown lint: `unnameable_types`
+ --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ |
+LL | #![warn(unnameable_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `unnameable_types` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+
+warning: unknown lint: `private_interfaces`
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
+ |
+LL | #![warn(private_interfaces)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `private_interfaces` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+
+warning: unknown lint: `private_bounds`
+ --> $DIR/feature-gate-type_privacy_lints.rs:6:1
+ |
+LL | #![warn(private_bounds)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `private_bounds` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+
+warning: unknown lint: `unnameable_types`
+ --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ |
+LL | #![warn(unnameable_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `unnameable_types` lint is unstable
+ = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
+ = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+
+warning: 9 warnings emitted
+