about summary refs log tree commit diff
path: root/src/test/ui/feature-gates
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-10 23:12:57 +0100
committerGitHub <noreply@github.com>2022-03-10 23:12:57 +0100
commit1ed2a94fd2d7e1440531e07932bb85bddcc4c1b1 (patch)
treec7611875d9d9b5cdd9722f9e6f3d06d3999df942 /src/test/ui/feature-gates
parent5a7f09d9a3e56e2370731d1cdab78cbcb3451d0f (diff)
parent1c31a95df7de66dc7842b43facf185ef8a776e6f (diff)
downloadrust-1ed2a94fd2d7e1440531e07932bb85bddcc4c1b1.tar.gz
rust-1ed2a94fd2d7e1440531e07932bb85bddcc4c1b1.zip
Rollup merge of #94274 - djkoloski:unknown_unstable_lints, r=tmandry
Treat unstable lints as unknown

This change causes unstable lints to be ignored if the `unknown_lints`
lint is allowed. To achieve this, it also changes lints to apply as soon
as they are processed. Previously, lints in the same set were processed
as a batch and then all simultaneously applied.

Implementation of https://github.com/rust-lang/compiler-team/issues/469
Diffstat (limited to 'src/test/ui/feature-gates')
-rw-r--r--src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs23
-rw-r--r--src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr75
-rw-r--r--src/test/ui/feature-gates/feature-gate-test_unstable_lint.rs9
-rw-r--r--src/test/ui/feature-gates/feature-gate-test_unstable_lint.stderr30
4 files changed, 105 insertions, 32 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
index 2a34ed4d4f6..29a6e1f8a01 100644
--- a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
+++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
@@ -1,9 +1,11 @@
+// check-fail
+
 #![deny(non_exhaustive_omitted_patterns)]
-//~^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable
-//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
+//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
+//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
 #![allow(non_exhaustive_omitted_patterns)]
-//~^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable
-//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
+//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
+//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
 
 fn main() {
     enum Foo {
@@ -11,14 +13,15 @@ fn main() {
     }
 
     #[allow(non_exhaustive_omitted_patterns)]
+    //~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
+    //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+    //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+    //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
     match Foo::A {
         Foo::A => {}
         Foo::B => {}
     }
-    //~^^^^^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable
-    //~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
-    //~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
-    //~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
+    //~^^^^ ERROR non-exhaustive patterns: `C` not covered
 
     match Foo::A {
         Foo::A => {}
@@ -26,6 +29,6 @@ fn main() {
         #[warn(non_exhaustive_omitted_patterns)]
         _ => {}
     }
-    //~^^^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable
-    //~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
+    //~^^^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
+    //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
 }
diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
index 691f64cf0ad..dbeef6c2d2a 100644
--- a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
+++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
@@ -1,93 +1,124 @@
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:1:1
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1
    |
 LL | #![deny(non_exhaustive_omitted_patterns)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: `#[warn(unknown_lints)]` on by default
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:4:1
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:6:1
    |
 LL | #![allow(non_exhaustive_omitted_patterns)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
    |
 LL |     #[allow(non_exhaustive_omitted_patterns)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
    |
 LL |     #[allow(non_exhaustive_omitted_patterns)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:26:9
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:29:9
    |
 LL |         #[warn(non_exhaustive_omitted_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:1:1
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1
    |
 LL | #![deny(non_exhaustive_omitted_patterns)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:4:1
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:6:1
    |
 LL | #![allow(non_exhaustive_omitted_patterns)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
    |
 LL |     #[allow(non_exhaustive_omitted_patterns)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
    |
 LL |     #[allow(non_exhaustive_omitted_patterns)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
-  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:26:9
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:29:9
    |
 LL |         #[warn(non_exhaustive_omitted_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
+   = note: the `non_exhaustive_omitted_patterns` lint is unstable
    = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
    = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
 
-error: aborting due to 10 previous errors
+error[E0004]: non-exhaustive patterns: `C` not covered
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:20:11
+   |
+LL |     match Foo::A {
+   |           ^^^^^^ pattern `C` not covered
+   |
+note: `Foo` defined here
+  --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:12:15
+   |
+LL |     enum Foo {
+   |          ---
+LL |         A, B, C,
+   |               ^ not covered
+   = note: the matched value is of type `Foo`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+   |
+LL ~         Foo::B => {}
+LL +         C => todo!()
+   |
+
+error: aborting due to previous error; 10 warnings emitted
 
-For more information about this error, try `rustc --explain E0658`.
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/ui/feature-gates/feature-gate-test_unstable_lint.rs b/src/test/ui/feature-gates/feature-gate-test_unstable_lint.rs
new file mode 100644
index 00000000000..c398394cbe1
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-test_unstable_lint.rs
@@ -0,0 +1,9 @@
+// check-pass
+
+// `test_unstable_lint` is for testing and should never be stabilized.
+#![allow(test_unstable_lint)]
+//~^ WARNING unknown lint: `test_unstable_lint`
+//~| WARNING unknown lint: `test_unstable_lint`
+//~| WARNING unknown lint: `test_unstable_lint`
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-test_unstable_lint.stderr b/src/test/ui/feature-gates/feature-gate-test_unstable_lint.stderr
new file mode 100644
index 00000000000..a29322443ea
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-test_unstable_lint.stderr
@@ -0,0 +1,30 @@
+warning: unknown lint: `test_unstable_lint`
+  --> $DIR/feature-gate-test_unstable_lint.rs:4:1
+   |
+LL | #![allow(test_unstable_lint)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(unknown_lints)]` on by default
+   = note: the `test_unstable_lint` lint is unstable
+   = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+
+warning: unknown lint: `test_unstable_lint`
+  --> $DIR/feature-gate-test_unstable_lint.rs:4:1
+   |
+LL | #![allow(test_unstable_lint)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: the `test_unstable_lint` lint is unstable
+   = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+
+warning: unknown lint: `test_unstable_lint`
+  --> $DIR/feature-gate-test_unstable_lint.rs:4:1
+   |
+LL | #![allow(test_unstable_lint)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: the `test_unstable_lint` lint is unstable
+   = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+
+warning: 3 warnings emitted
+