summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lint/force-warn
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/lint/force-warn')
-rw-r--r--src/test/ui/lint/force-warn/allow-warnings.rs11
-rw-r--r--src/test/ui/lint/force-warn/allow-warnings.stderr10
-rw-r--r--src/test/ui/lint/force-warn/allowed-by-default-lint.rs12
-rw-r--r--src/test/ui/lint/force-warn/allowed-by-default-lint.stderr14
-rw-r--r--src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs10
-rw-r--r--src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr23
-rw-r--r--src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs11
-rw-r--r--src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr23
-rw-r--r--src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.rs18
-rw-r--r--src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr45
-rw-r--r--src/test/ui/lint/force-warn/allowed-warn-by-default-lint.rs11
-rw-r--r--src/test/ui/lint/force-warn/allowed-warn-by-default-lint.stderr10
-rw-r--r--src/test/ui/lint/force-warn/cap-lints-allow.rs16
-rw-r--r--src/test/ui/lint/force-warn/cap-lints-allow.stderr45
-rw-r--r--src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.rs17
-rw-r--r--src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr12
-rw-r--r--src/test/ui/lint/force-warn/deny-by-default-lint.rs9
-rw-r--r--src/test/ui/lint/force-warn/deny-by-default-lint.stderr23
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allow-warnings.rs12
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allow-warnings.stderr10
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.rs16
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr45
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allowed-lint-group.rs18
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr45
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.rs18
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr45
-rw-r--r--src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs18
-rw-r--r--src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr16
-rw-r--r--src/test/ui/lint/force-warn/warnings-lint-group.rs5
-rw-r--r--src/test/ui/lint/force-warn/warnings-lint-group.stderr7
30 files changed, 575 insertions, 0 deletions
diff --git a/src/test/ui/lint/force-warn/allow-warnings.rs b/src/test/ui/lint/force-warn/allow-warnings.rs
new file mode 100644
index 000000000..0199381fc
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allow-warnings.rs
@@ -0,0 +1,11 @@
+// --force-warn $LINT causes $LINT (which is warn-by-default) to warn
+// despite allowing all warnings in module
+// compile-flags: --force-warn dead_code
+// check-pass
+
+#![allow(warnings)]
+
+fn dead_function() {}
+//~^ WARN function `dead_function` is never used
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/allow-warnings.stderr b/src/test/ui/lint/force-warn/allow-warnings.stderr
new file mode 100644
index 000000000..4de68a079
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allow-warnings.stderr
@@ -0,0 +1,10 @@
+warning: function `dead_function` is never used
+ --> $DIR/allow-warnings.rs:8:4
+ |
+LL | fn dead_function() {}
+ | ^^^^^^^^^^^^^
+ |
+ = note: requested on the command line with `--force-warn dead-code`
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/lint/force-warn/allowed-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-by-default-lint.rs
new file mode 100644
index 000000000..b24ab822d
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-by-default-lint.rs
@@ -0,0 +1,12 @@
+// --force-warn $LINT causes $LINT (which is allow-by-default) to warn
+// compile-flags: --force-warn elided_lifetimes_in_paths
+// check-pass
+
+struct Foo<'a> {
+ x: &'a u32,
+}
+
+fn foo(x: &Foo) {}
+//~^ WARN hidden lifetime parameters in types are deprecated
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/allowed-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-by-default-lint.stderr
new file mode 100644
index 000000000..ac98b5896
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-by-default-lint.stderr
@@ -0,0 +1,14 @@
+warning: hidden lifetime parameters in types are deprecated
+ --> $DIR/allowed-by-default-lint.rs:9:12
+ |
+LL | fn foo(x: &Foo) {}
+ | ^^^ expected lifetime parameter
+ |
+ = note: requested on the command line with `--force-warn elided-lifetimes-in-paths`
+help: indicate the anonymous lifetime
+ |
+LL | fn foo(x: &Foo<'_>) {}
+ | ++++
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs
new file mode 100644
index 000000000..3a3d81176
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs
@@ -0,0 +1,10 @@
+// --force-warn $LINT causes $LINT (which is deny-by-default) to warn
+// despite $LINT being allowed on command line
+// compile-flags: -A const_err --force-warn const_err
+// check-pass
+
+const C: i32 = 1 / 0;
+//~^ WARN any use of this value will cause an error
+//~| WARN this was previously accepted by the compiler
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr
new file mode 100644
index 000000000..915b3b86f
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr
@@ -0,0 +1,23 @@
+warning: any use of this value will cause an error
+ --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16
+ |
+LL | const C: i32 = 1 / 0;
+ | ------------ ^^^^^ attempt to divide `1_i32` by zero
+ |
+ = note: requested on the command line with `--force-warn const-err`
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+
+warning: 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+warning: any use of this value will cause an error
+ --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16
+ |
+LL | const C: i32 = 1 / 0;
+ | ------------ ^^^^^ attempt to divide `1_i32` by zero
+ |
+ = note: requested on the command line with `--force-warn const-err`
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+
diff --git a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs
new file mode 100644
index 000000000..08e75a775
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs
@@ -0,0 +1,11 @@
+// --force-warn $LINT causes $LINT (which is deny-by-default) to warn
+// despite $LINT being allowed in module
+// compile-flags: --force-warn const_err
+// check-pass
+
+#![allow(const_err)]
+const C: i32 = 1 / 0;
+//~^ WARN any use of this value will cause an error
+//~| WARN this was previously accepted by the compiler
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr
new file mode 100644
index 000000000..3b36d1d02
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr
@@ -0,0 +1,23 @@
+warning: any use of this value will cause an error
+ --> $DIR/allowed-deny-by-default-lint.rs:7:16
+ |
+LL | const C: i32 = 1 / 0;
+ | ------------ ^^^^^ attempt to divide `1_i32` by zero
+ |
+ = note: requested on the command line with `--force-warn const-err`
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+
+warning: 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+warning: any use of this value will cause an error
+ --> $DIR/allowed-deny-by-default-lint.rs:7:16
+ |
+LL | const C: i32 = 1 / 0;
+ | ------------ ^^^^^ attempt to divide `1_i32` by zero
+ |
+ = note: requested on the command line with `--force-warn const-err`
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+
diff --git a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.rs
new file mode 100644
index 000000000..631a8cb2f
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.rs
@@ -0,0 +1,18 @@
+// --force-warn $LINT causes $LINT (which is warn-by-default) to warn
+// despite $LINT_GROUP (which contains $LINT) being allowed
+// compile-flags: --force-warn bare_trait_objects
+// check-pass
+
+#![allow(rust_2018_idioms)]
+
+pub trait SomeTrait {}
+
+pub fn function(_x: Box<SomeTrait>) {}
+//~^ WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
new file mode 100644
index 000000000..8d826bd14
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
@@ -0,0 +1,45 @@
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/allowed-group-warn-by-default-lint.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = note: requested on the command line with `--force-warn bare-trait-objects`
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/allowed-group-warn-by-default-lint.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/allowed-group-warn-by-default-lint.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: 3 warnings emitted
+
diff --git a/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.rs
new file mode 100644
index 000000000..06b372867
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.rs
@@ -0,0 +1,11 @@
+// --force-warn $LINT causes $LINT (which is warn-by-default) to warn
+// despite $LINT being allowed in module
+// compile-flags: --force-warn dead_code
+// check-pass
+
+#![allow(dead_code)]
+
+fn dead_function() {}
+//~^ WARN function `dead_function` is never used
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.stderr
new file mode 100644
index 000000000..a6634e212
--- /dev/null
+++ b/src/test/ui/lint/force-warn/allowed-warn-by-default-lint.stderr
@@ -0,0 +1,10 @@
+warning: function `dead_function` is never used
+ --> $DIR/allowed-warn-by-default-lint.rs:8:4
+ |
+LL | fn dead_function() {}
+ | ^^^^^^^^^^^^^
+ |
+ = note: requested on the command line with `--force-warn dead-code`
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/lint/force-warn/cap-lints-allow.rs b/src/test/ui/lint/force-warn/cap-lints-allow.rs
new file mode 100644
index 000000000..fdba7f410
--- /dev/null
+++ b/src/test/ui/lint/force-warn/cap-lints-allow.rs
@@ -0,0 +1,16 @@
+// --force-warn $LINT casuses $LINT to warn despite --cap-lints
+// set to allow
+// compile-flags: --cap-lints allow --force-warn bare_trait_objects
+// check-pass
+
+pub trait SomeTrait {}
+
+pub fn function(_x: Box<SomeTrait>) {}
+//~^ WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/cap-lints-allow.stderr b/src/test/ui/lint/force-warn/cap-lints-allow.stderr
new file mode 100644
index 000000000..978270872
--- /dev/null
+++ b/src/test/ui/lint/force-warn/cap-lints-allow.stderr
@@ -0,0 +1,45 @@
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/cap-lints-allow.rs:8:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = note: requested on the command line with `--force-warn bare-trait-objects`
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/cap-lints-allow.rs:8:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/cap-lints-allow.rs:8:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: 3 warnings emitted
+
diff --git a/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.rs b/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.rs
new file mode 100644
index 000000000..e65f156bf
--- /dev/null
+++ b/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.rs
@@ -0,0 +1,17 @@
+// --force-warn $LINT_GROUP causes $LINT to warn despite $LINT being
+// allowed in module and cap-lints set to warn
+// compile-flags: --cap-lints warn --force-warn rust-2021-compatibility
+// check-pass
+#![allow(ellipsis_inclusive_range_patterns)]
+
+pub fn f() -> bool {
+ let x = 123;
+ match x {
+ 0...100 => true,
+ //~^ WARN range patterns are deprecated
+ //~| WARN this is accepted in the current edition
+ _ => false,
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr
new file mode 100644
index 000000000..3dafaf705
--- /dev/null
+++ b/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr
@@ -0,0 +1,12 @@
+warning: `...` range patterns are deprecated
+ --> $DIR/cap-lints-warn-allowed-warn-by-default-lint.rs:10:10
+ |
+LL | 0...100 => true,
+ | ^^^ help: use `..=` for an inclusive range
+ |
+ = note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility`
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/lint/force-warn/deny-by-default-lint.rs b/src/test/ui/lint/force-warn/deny-by-default-lint.rs
new file mode 100644
index 000000000..e37102903
--- /dev/null
+++ b/src/test/ui/lint/force-warn/deny-by-default-lint.rs
@@ -0,0 +1,9 @@
+// --force-warn $LINT causes $LINT (which is deny-by-default) to warn
+// compile-flags: --force-warn const_err
+// check-pass
+
+const C: i32 = 1 / 0;
+//~^ WARN any use of this value will cause an error
+//~| WARN this was previously accepted by the compiler
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr
new file mode 100644
index 000000000..a2e5baa8b
--- /dev/null
+++ b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr
@@ -0,0 +1,23 @@
+warning: any use of this value will cause an error
+ --> $DIR/deny-by-default-lint.rs:5:16
+ |
+LL | const C: i32 = 1 / 0;
+ | ------------ ^^^^^ attempt to divide `1_i32` by zero
+ |
+ = note: requested on the command line with `--force-warn const-err`
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+
+warning: 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+warning: any use of this value will cause an error
+ --> $DIR/deny-by-default-lint.rs:5:16
+ |
+LL | const C: i32 = 1 / 0;
+ | ------------ ^^^^^ attempt to divide `1_i32` by zero
+ |
+ = note: requested on the command line with `--force-warn const-err`
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+
diff --git a/src/test/ui/lint/force-warn/lint-group-allow-warnings.rs b/src/test/ui/lint/force-warn/lint-group-allow-warnings.rs
new file mode 100644
index 000000000..4b95f4d2d
--- /dev/null
+++ b/src/test/ui/lint/force-warn/lint-group-allow-warnings.rs
@@ -0,0 +1,12 @@
+// --force-warn $LINT_GROUP causes $LINT in $LINT_GROUP to warn
+// despite all warnings being allowed in module
+// warn-by-default lint to warn
+// compile-flags: --force-warn nonstandard_style
+// check-pass
+
+#![allow(warnings)]
+
+pub fn FUNCTION() {}
+//~^ WARN function `FUNCTION` should have a snake case name
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/lint-group-allow-warnings.stderr b/src/test/ui/lint/force-warn/lint-group-allow-warnings.stderr
new file mode 100644
index 000000000..dc7b1b7b9
--- /dev/null
+++ b/src/test/ui/lint/force-warn/lint-group-allow-warnings.stderr
@@ -0,0 +1,10 @@
+warning: function `FUNCTION` should have a snake case name
+ --> $DIR/lint-group-allow-warnings.rs:9:8
+ |
+LL | pub fn FUNCTION() {}
+ | ^^^^^^^^ help: convert the identifier to snake case: `function`
+ |
+ = note: `--force-warn non-snake-case` implied by `--force-warn nonstandard-style`
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.rs b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.rs
new file mode 100644
index 000000000..7ad7462dd
--- /dev/null
+++ b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.rs
@@ -0,0 +1,16 @@
+// --force-warn $LINT_GROUP causes $LINT (which is warn-by-default) to warn
+// despite $LINT being allowed on command line
+// compile-flags: -A bare-trait-objects --force-warn rust-2018-idioms
+// check-pass
+
+pub trait SomeTrait {}
+
+pub fn function(_x: Box<SomeTrait>) {}
+//~^ WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
new file mode 100644
index 000000000..6e67ebf27
--- /dev/null
+++ b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
@@ -0,0 +1,45 @@
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: 3 warnings emitted
+
diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.rs b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.rs
new file mode 100644
index 000000000..ee5a18c38
--- /dev/null
+++ b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.rs
@@ -0,0 +1,18 @@
+// --force-warn $LINT_GROUP causes $LINT to warn despite
+// $LINT_GROUP being allowed in module
+// compile-flags: --force-warn rust_2018_idioms
+// check-pass
+
+#![allow(rust_2018_idioms)]
+
+pub trait SomeTrait {}
+
+pub fn function(_x: Box<SomeTrait>) {}
+//~^ WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
new file mode 100644
index 000000000..c5dea84b8
--- /dev/null
+++ b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
@@ -0,0 +1,45 @@
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-lint-group.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-lint-group.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-lint-group.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: 3 warnings emitted
+
diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.rs b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.rs
new file mode 100644
index 000000000..248aece6f
--- /dev/null
+++ b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.rs
@@ -0,0 +1,18 @@
+// --force-warn $LINT_GROUP causes $LINT (which is warn-by-default) to warn
+// despite $LINT being allowed in module
+// compile-flags: --force-warn rust-2018-idioms
+// check-pass
+
+#![allow(bare_trait_objects)]
+
+pub trait SomeTrait {}
+
+pub fn function(_x: Box<SomeTrait>) {}
+//~^ WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
new file mode 100644
index 000000000..acd0c503d
--- /dev/null
+++ b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
@@ -0,0 +1,45 @@
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25
+ |
+LL | pub fn function(_x: Box<SomeTrait>) {}
+ | ^^^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL - pub fn function(_x: Box<SomeTrait>) {}
+LL + pub fn function(_x: Box<dyn SomeTrait>) {}
+ |
+
+warning: 3 warnings emitted
+
diff --git a/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs b/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs
new file mode 100644
index 000000000..47a480ad7
--- /dev/null
+++ b/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs
@@ -0,0 +1,18 @@
+// --force-warn $LINT causes $LINT (which is warn-by-default) to warn
+// despite being allowed in one submodule (but not the other)
+// compile-flags: --force-warn dead_code
+// check-pass
+
+mod one {
+ #![allow(dead_code)]
+
+ fn dead_function() {}
+ //~^ WARN function `dead_function` is never used
+}
+
+mod two {
+ fn dead_function() {}
+ //~^ WARN function `dead_function` is never used
+}
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr b/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr
new file mode 100644
index 000000000..824bcccc0
--- /dev/null
+++ b/src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr
@@ -0,0 +1,16 @@
+warning: function `dead_function` is never used
+ --> $DIR/warn-by-default-lint-two-modules.rs:9:8
+ |
+LL | fn dead_function() {}
+ | ^^^^^^^^^^^^^
+ |
+ = note: requested on the command line with `--force-warn dead-code`
+
+warning: function `dead_function` is never used
+ --> $DIR/warn-by-default-lint-two-modules.rs:14:8
+ |
+LL | fn dead_function() {}
+ | ^^^^^^^^^^^^^
+
+warning: 2 warnings emitted
+
diff --git a/src/test/ui/lint/force-warn/warnings-lint-group.rs b/src/test/ui/lint/force-warn/warnings-lint-group.rs
new file mode 100644
index 000000000..d1d4f5602
--- /dev/null
+++ b/src/test/ui/lint/force-warn/warnings-lint-group.rs
@@ -0,0 +1,5 @@
+// --force-warn warnings is an error
+// compile-flags: --force-warn warnings
+// error-pattern: `warnings` lint group is not supported
+
+fn main() {}
diff --git a/src/test/ui/lint/force-warn/warnings-lint-group.stderr b/src/test/ui/lint/force-warn/warnings-lint-group.stderr
new file mode 100644
index 000000000..1faeed337
--- /dev/null
+++ b/src/test/ui/lint/force-warn/warnings-lint-group.stderr
@@ -0,0 +1,7 @@
+error[E0602]: `warnings` lint group is not supported with ´--force-warn´
+
+error[E0602]: `warnings` lint group is not supported with ´--force-warn´
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0602`.