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/allowed-cli-deny-by-default-lint.rs12
-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.rs14
-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.stderr2
-rw-r--r--src/test/ui/lint/force-warn/cap-lints-allow.stderr2
-rw-r--r--src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr2
-rw-r--r--src/test/ui/lint/force-warn/deny-by-default-lint.rs12
-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-allowed-cli-warn-by-default-lint.stderr2
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr2
-rw-r--r--src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr2
12 files changed, 40 insertions, 79 deletions
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
index 3a3d81176..257df13ef 100644
--- 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
@@ -1,10 +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
+// compile-flags: -A mutable_transmutes --force-warn mutable_transmutes
// 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() {}
+fn main() {
+ unsafe {
+ let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior
+ }
+}
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
index 915b3b86f..6a1fc76e1 100644
--- 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
@@ -1,23 +1,10 @@
-warning: any use of this value will cause an error
- --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16
+warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell
+ --> $DIR/allowed-cli-deny-by-default-lint.rs:8:17
|
-LL | const C: i32 = 1 / 0;
- | ------------ ^^^^^ attempt to divide `1_i32` by zero
+LL | let y = std::mem::transmute::<&i32, &mut i32>(&5);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = 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>
+ = note: requested on the command line with `--force-warn mutable-transmutes`
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
index 08e75a775..0d4b468c2 100644
--- 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
@@ -1,11 +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
+// compile-flags: --force-warn mutable_transmutes
// 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() {}
+#![allow(mutable_transmutes)]
+fn main() {
+ unsafe {
+ let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior
+ }
+}
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
index 3b36d1d02..9ef53d47e 100644
--- 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
@@ -1,23 +1,10 @@
-warning: any use of this value will cause an error
- --> $DIR/allowed-deny-by-default-lint.rs:7:16
+warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell
+ --> $DIR/allowed-deny-by-default-lint.rs:9:17
|
-LL | const C: i32 = 1 / 0;
- | ------------ ^^^^^ attempt to divide `1_i32` by zero
+LL | let y = std::mem::transmute::<&i32, &mut i32>(&5);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = 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>
+ = note: requested on the command line with `--force-warn mutable-transmutes`
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.stderr b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
index 94d81c3aa..0f58953a5 100644
--- 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
@@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated
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>
+ = note: requested on the command line with `--force-warn bare-trait-objects`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/src/test/ui/lint/force-warn/cap-lints-allow.stderr b/src/test/ui/lint/force-warn/cap-lints-allow.stderr
index 7f0fd8530..03a32fa6f 100644
--- a/src/test/ui/lint/force-warn/cap-lints-allow.stderr
+++ b/src/test/ui/lint/force-warn/cap-lints-allow.stderr
@@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated
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>
+ = note: requested on the command line with `--force-warn bare-trait-objects`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
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
index 3dafaf705..d1b764b34 100644
--- 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
@@ -4,9 +4,9 @@ warning: `...` range patterns are deprecated
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>
+ = note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility`
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
index e37102903..c2e9377e9 100644
--- a/src/test/ui/lint/force-warn/deny-by-default-lint.rs
+++ b/src/test/ui/lint/force-warn/deny-by-default-lint.rs
@@ -1,9 +1,9 @@
// --force-warn $LINT causes $LINT (which is deny-by-default) to warn
-// compile-flags: --force-warn const_err
+// compile-flags: --force-warn mutable_transmutes
// 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() {}
+fn main() {
+ unsafe {
+ let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior
+ }
+}
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
index a2e5baa8b..c644d0fe7 100644
--- a/src/test/ui/lint/force-warn/deny-by-default-lint.stderr
+++ b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr
@@ -1,23 +1,10 @@
-warning: any use of this value will cause an error
- --> $DIR/deny-by-default-lint.rs:5:16
+warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell
+ --> $DIR/deny-by-default-lint.rs:7:17
|
-LL | const C: i32 = 1 / 0;
- | ------------ ^^^^^ attempt to divide `1_i32` by zero
+LL | let y = std::mem::transmute::<&i32, &mut i32>(&5);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = 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>
+ = note: requested on the command line with `--force-warn mutable-transmutes`
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-allowed-cli-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
index eb2bca7b8..e17630fd3 100644
--- 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
@@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated
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>
+ = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
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
index ed01937a5..72198541a 100644
--- 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
@@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated
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>
+ = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
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
index 8db7c1275..52c870ac2 100644
--- 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
@@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated
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>
+ = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}