summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/lint
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint')
-rw-r--r--tests/ui/lint/bare-trait-objects-path.stderr2
-rw-r--r--tests/ui/lint/cli-unknown-force-warn.stderr2
-rw-r--r--tests/ui/lint/command-line-register-unknown-lint-tool.stderr1
-rw-r--r--tests/ui/lint/crate_level_only_lint.stderr12
-rw-r--r--tests/ui/lint/forbid-group-group-2.stderr8
-rw-r--r--tests/ui/lint/forbid-group-member.stderr2
-rw-r--r--tests/ui/lint/forbid-member-group.stderr2
-rw-r--r--tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/cap-lints-allow.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/warnings-lint-group.stderr2
-rw-r--r--tests/ui/lint/issue-80988.stderr2
-rw-r--r--tests/ui/lint/lint-forbid-attr.stderr2
-rw-r--r--tests/ui/lint/lint-forbid-cmdline.stderr1
-rw-r--r--tests/ui/lint/lint-malformed.stderr6
-rw-r--r--tests/ui/lint/lint-removed-cmdline-deny.stderr2
-rw-r--r--tests/ui/lint/lint-removed-cmdline.stderr2
-rw-r--r--tests/ui/lint/lint-renamed-cmdline-deny.stderr2
-rw-r--r--tests/ui/lint/lint-renamed-cmdline.stderr2
-rw-r--r--tests/ui/lint/lint-stability-deprecated.stderr6
-rw-r--r--tests/ui/lint/lint-type-overflow.stderr42
-rw-r--r--tests/ui/lint/lint-unexported-no-mangle.stderr4
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr4
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline.stderr4
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.fixed8
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.rs8
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.stderr74
-rw-r--r--tests/ui/lint/missing-copy-implementations-non-exhaustive.rs25
-rw-r--r--tests/ui/lint/must_not_suspend/gated.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/tuple-mismatch.rs4
-rw-r--r--tests/ui/lint/reasons-erroneous.rs28
-rw-r--r--tests/ui/lint/reasons-erroneous.stderr94
-rw-r--r--tests/ui/lint/reference_casting.rs8
-rw-r--r--tests/ui/lint/reference_casting.stderr60
-rw-r--r--tests/ui/lint/register-tool-lint.stderr1
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs30
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs8
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr30
-rw-r--r--tests/ui/lint/unaligned_references.rs23
-rw-r--r--tests/ui/lint/unaligned_references.stderr52
-rw-r--r--tests/ui/lint/unused/issue-117284-arg-in-macro.rs17
-rw-r--r--tests/ui/lint/unused/issue-117284-arg-in-macro.stderr29
-rw-r--r--tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs6
-rw-r--r--tests/ui/lint/unused/lint-unused-imports.rs2
-rw-r--r--tests/ui/lint/unused/unused-closure.rs4
47 files changed, 428 insertions, 205 deletions
diff --git a/tests/ui/lint/bare-trait-objects-path.stderr b/tests/ui/lint/bare-trait-objects-path.stderr
index a19f4963c..01ca08a6f 100644
--- a/tests/ui/lint/bare-trait-objects-path.stderr
+++ b/tests/ui/lint/bare-trait-objects-path.stderr
@@ -16,7 +16,7 @@ error[E0223]: ambiguous associated type
--> $DIR/bare-trait-objects-path.rs:23:12
|
LL | let _: Dyn::Ty;
- | ^^^^^^^ help: use the fully-qualified path: `<dyn Dyn as Assoc>::Ty`
+ | ^^^^^^^ help: use fully-qualified syntax: `<dyn Dyn as Assoc>::Ty`
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:14:5
diff --git a/tests/ui/lint/cli-unknown-force-warn.stderr b/tests/ui/lint/cli-unknown-force-warn.stderr
index 2ee718a8c..5084b4a40 100644
--- a/tests/ui/lint/cli-unknown-force-warn.stderr
+++ b/tests/ui/lint/cli-unknown-force-warn.stderr
@@ -6,10 +6,12 @@ warning[E0602]: unknown lint: `foo_qux`
warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/command-line-register-unknown-lint-tool.stderr b/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
index c9a2aff21..65aa19628 100644
--- a/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
+++ b/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
@@ -5,6 +5,7 @@ error[E0602]: unknown lint tool: `unknown_tool`
error[E0602]: unknown lint tool: `unknown_tool`
|
= note: requested on the command line with `-A unknown_tool::foo`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/crate_level_only_lint.stderr b/tests/ui/lint/crate_level_only_lint.stderr
index 8fb06df2a..fbb1ec381 100644
--- a/tests/ui/lint/crate_level_only_lint.stderr
+++ b/tests/ui/lint/crate_level_only_lint.stderr
@@ -27,36 +27,48 @@ error: allow(uncommon_codepoints) is ignored unless specified at crate level
|
LL | #![allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:4:10
|
LL | #![allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 9 previous errors
diff --git a/tests/ui/lint/forbid-group-group-2.stderr b/tests/ui/lint/forbid-group-group-2.stderr
index b2e2bcea1..4a2c8fbd6 100644
--- a/tests/ui/lint/forbid-group-group-2.stderr
+++ b/tests/ui/lint/forbid-group-group-2.stderr
@@ -26,6 +26,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -38,6 +39,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -50,6 +52,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -62,6 +65,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -74,6 +78,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -86,6 +91,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -98,6 +104,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -110,6 +117,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 9 previous errors
diff --git a/tests/ui/lint/forbid-group-member.stderr b/tests/ui/lint/forbid-group-member.stderr
index 47336d4d8..ddaaafa12 100644
--- a/tests/ui/lint/forbid-group-member.stderr
+++ b/tests/ui/lint/forbid-group-member.stderr
@@ -22,6 +22,7 @@ LL | #[allow(unused_variables)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: allow(unused_variables) incompatible with previous forbid
--> $DIR/forbid-group-member.rs:8:9
@@ -34,6 +35,7 @@ LL | #[allow(unused_variables)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/forbid-member-group.stderr b/tests/ui/lint/forbid-member-group.stderr
index e65301778..612dccd8d 100644
--- a/tests/ui/lint/forbid-member-group.stderr
+++ b/tests/ui/lint/forbid-member-group.stderr
@@ -15,6 +15,8 @@ LL | #![forbid(unused_variables)]
LL |
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
index 0f58953a5..ecdc62501 100644
--- a/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
@@ -20,6 +20,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -33,6 +34,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/cap-lints-allow.stderr b/tests/ui/lint/force-warn/cap-lints-allow.stderr
index 03a32fa6f..5f5f2ff52 100644
--- a/tests/ui/lint/force-warn/cap-lints-allow.stderr
+++ b/tests/ui/lint/force-warn/cap-lints-allow.stderr
@@ -20,6 +20,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -33,6 +34,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
index b0cd3ddd2..3a0b1201b 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
@@ -21,6 +21,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
index 8c841916c..92555eda2 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
@@ -21,6 +21,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
index c0144205d..c14c7957a 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
@@ -21,6 +21,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,7 @@ 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>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/warnings-lint-group.stderr b/tests/ui/lint/force-warn/warnings-lint-group.stderr
index 1faeed337..3e73269a2 100644
--- a/tests/ui/lint/force-warn/warnings-lint-group.stderr
+++ b/tests/ui/lint/force-warn/warnings-lint-group.stderr
@@ -1,6 +1,8 @@
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/issue-80988.stderr b/tests/ui/lint/issue-80988.stderr
index 73e27ffda..7a65881b5 100644
--- a/tests/ui/lint/issue-80988.stderr
+++ b/tests/ui/lint/issue-80988.stderr
@@ -22,6 +22,7 @@ LL | #[deny(warnings)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: deny(warnings) incompatible with previous forbid
--> $DIR/issue-80988.rs:7:8
@@ -34,6 +35,7 @@ LL | #[deny(warnings)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/lint-forbid-attr.stderr b/tests/ui/lint/lint-forbid-attr.stderr
index 5977b9c94..bd476a0e3 100644
--- a/tests/ui/lint/lint-forbid-attr.stderr
+++ b/tests/ui/lint/lint-forbid-attr.stderr
@@ -15,6 +15,8 @@ LL | #![forbid(deprecated)]
LL |
LL | #[allow(deprecated)]
| ^^^^^^^^^^ overruled by previous forbid
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/lint-forbid-cmdline.stderr b/tests/ui/lint/lint-forbid-cmdline.stderr
index 0a92e58c0..ed49a2cb4 100644
--- a/tests/ui/lint/lint-forbid-cmdline.stderr
+++ b/tests/ui/lint/lint-forbid-cmdline.stderr
@@ -13,6 +13,7 @@ LL | #[allow(deprecated)]
| ^^^^^^^^^^ overruled by previous forbid
|
= note: `forbid` lint level was set on command line
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/lint-malformed.stderr b/tests/ui/lint/lint-malformed.stderr
index 91b4e509b..2c9f045de 100644
--- a/tests/ui/lint/lint-malformed.stderr
+++ b/tests/ui/lint/lint-malformed.stderr
@@ -9,6 +9,8 @@ error[E0452]: malformed lint attribute input
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: malformed `deny` attribute input
--> $DIR/lint-malformed.rs:1:1
@@ -21,12 +23,16 @@ error[E0452]: malformed lint attribute input
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/lint-malformed.rs:2:10
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 5 previous errors
diff --git a/tests/ui/lint/lint-removed-cmdline-deny.stderr b/tests/ui/lint/lint-removed-cmdline-deny.stderr
index 80c85d01e..3321afa7f 100644
--- a/tests/ui/lint/lint-removed-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-removed-cmdline-deny.stderr
@@ -6,10 +6,12 @@ error: lint `raw_pointer_derive` has been removed: using derive with raw pointer
error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-removed-cmdline-deny.rs:13:17
diff --git a/tests/ui/lint/lint-removed-cmdline.stderr b/tests/ui/lint/lint-removed-cmdline.stderr
index ebfae34ad..6b76ad3b5 100644
--- a/tests/ui/lint/lint-removed-cmdline.stderr
+++ b/tests/ui/lint/lint-removed-cmdline.stderr
@@ -6,10 +6,12 @@ warning: lint `raw_pointer_derive` has been removed: using derive with raw point
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-removed-cmdline.rs:13:17
diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.stderr b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
index df22ef60d..0e182a4e5 100644
--- a/tests/ui/lint/lint-renamed-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
@@ -8,11 +8,13 @@ error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
= help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
= help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline-deny.rs:10:17
diff --git a/tests/ui/lint/lint-renamed-cmdline.stderr b/tests/ui/lint/lint-renamed-cmdline.stderr
index a41284003..675443dde 100644
--- a/tests/ui/lint/lint-renamed-cmdline.stderr
+++ b/tests/ui/lint/lint-renamed-cmdline.stderr
@@ -8,11 +8,13 @@ warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
= help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
= help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline.rs:9:17
diff --git a/tests/ui/lint/lint-stability-deprecated.stderr b/tests/ui/lint/lint-stability-deprecated.stderr
index 19a4649e1..609fc56a8 100644
--- a/tests/ui/lint/lint-stability-deprecated.stderr
+++ b/tests/ui/lint/lint-stability-deprecated.stderr
@@ -639,18 +639,24 @@ warning: use of deprecated associated type `lint_stability::TraitWithAssociatedT
|
LL | struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: use of deprecated associated type `lint_stability::TraitWithAssociatedTypes::TypeDeprecated`: text
--> $DIR/lint-stability-deprecated.rs:102:13
|
LL | TypeDeprecated = u16,
| ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: use of deprecated associated type `lint_stability::TraitWithAssociatedTypes::TypeDeprecated`: text
--> $DIR/lint-stability-deprecated.rs:102:13
|
LL | TypeDeprecated = u16,
| ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 108 warnings emitted
diff --git a/tests/ui/lint/lint-type-overflow.stderr b/tests/ui/lint/lint-type-overflow.stderr
index 48d8228b8..971c3eb9b 100644
--- a/tests/ui/lint/lint-type-overflow.stderr
+++ b/tests/ui/lint/lint-type-overflow.stderr
@@ -29,21 +29,21 @@ LL | let x1: i8 = 128;
= help: consider using the type `u8` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:18:19
+ --> $DIR/lint-type-overflow.rs:18:18
|
LL | let x3: i8 = -129;
- | ^^^
+ | ^^^^
|
- = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-129` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:19:19
+ --> $DIR/lint-type-overflow.rs:19:18
|
LL | let x3: i8 = -(129);
- | ^^^^^
+ | ^^^^^^
|
- = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-(129)` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i8`
@@ -74,12 +74,12 @@ LL | let x = 128_i8;
= help: consider using the type `u8` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:28:14
+ --> $DIR/lint-type-overflow.rs:28:13
|
LL | let x = -129_i8;
- | ^^^^^^
+ | ^^^^^^^
|
- = note: the literal `129_i8` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-129_i8` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i32`
@@ -101,21 +101,21 @@ LL | let x = 2147483648_i32;
= help: consider using the type `u32` instead
error: literal out of range for `i32`
- --> $DIR/lint-type-overflow.rs:36:19
+ --> $DIR/lint-type-overflow.rs:36:18
|
LL | let x: i32 = -2147483649;
- | ^^^^^^^^^^
+ | ^^^^^^^^^^^
|
- = note: the literal `2147483649` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
+ = note: the literal `-2147483649` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i64` instead
error: literal out of range for `i32`
- --> $DIR/lint-type-overflow.rs:37:14
+ --> $DIR/lint-type-overflow.rs:37:13
|
LL | let x = -2147483649_i32;
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^
|
- = note: the literal `2147483649_i32` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
+ = note: the literal `-2147483649_i32` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i64` instead
error: literal out of range for `i32`
@@ -146,21 +146,21 @@ LL | let x = 18446744073709551615_i64;
= help: consider using the type `u64` instead
error: literal out of range for `i64`
- --> $DIR/lint-type-overflow.rs:43:19
+ --> $DIR/lint-type-overflow.rs:43:18
|
LL | let x: i64 = -9223372036854775809;
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^
|
- = note: the literal `9223372036854775809` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
+ = note: the literal `-9223372036854775809` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
= help: consider using the type `i128` instead
error: literal out of range for `i64`
- --> $DIR/lint-type-overflow.rs:44:14
+ --> $DIR/lint-type-overflow.rs:44:13
|
LL | let x = -9223372036854775809_i64;
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: the literal `9223372036854775809_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
+ = note: the literal `-9223372036854775809_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
= help: consider using the type `i128` instead
error: aborting due to 18 previous errors
diff --git a/tests/ui/lint/lint-unexported-no-mangle.stderr b/tests/ui/lint/lint-unexported-no-mangle.stderr
index 858527822..0efec51ab 100644
--- a/tests/ui/lint/lint-unexported-no-mangle.stderr
+++ b/tests/ui/lint/lint-unexported-no-mangle.stderr
@@ -10,18 +10,22 @@ warning: lint `private_no_mangle_statics` has been removed: no longer a warning,
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: const items should never be `#[no_mangle]`
--> $DIR/lint-unexported-no-mangle.rs:9:1
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
index 677b5edc8..f12ce03dd 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
@@ -11,20 +11,24 @@ error[E0602]: unknown lint: `dead_cod`
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline.stderr b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
index 10db76ac4..f452fc9eb 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline.stderr
+++ b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
@@ -11,20 +11,24 @@ warning[E0602]: unknown lint: `dead_cod`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 6 warnings emitted
diff --git a/tests/ui/lint/lint-unnecessary-parens.fixed b/tests/ui/lint/lint-unnecessary-parens.fixed
index bafac05d8..b17914da6 100644
--- a/tests/ui/lint/lint-unnecessary-parens.fixed
+++ b/tests/ui/lint/lint-unnecessary-parens.fixed
@@ -84,6 +84,14 @@ fn main() {
_a = 0; //~ ERROR unnecessary parentheses around assigned value
_a += 1; //~ ERROR unnecessary parentheses around assigned value
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+
let _a = baz!(3, 4);
let _b = baz!(3);
}
diff --git a/tests/ui/lint/lint-unnecessary-parens.rs b/tests/ui/lint/lint-unnecessary-parens.rs
index ce537a4dc..4cbd6562c 100644
--- a/tests/ui/lint/lint-unnecessary-parens.rs
+++ b/tests/ui/lint/lint-unnecessary-parens.rs
@@ -84,6 +84,14 @@ fn main() {
_a = (0); //~ ERROR unnecessary parentheses around assigned value
_a += (1); //~ ERROR unnecessary parentheses around assigned value
+ let(mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let (mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let( mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+
+ let(_a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let (_a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let( _a) = 3; //~ ERROR unnecessary parentheses around pattern
+
let _a = baz!(3, 4);
let _b = baz!(3);
}
diff --git a/tests/ui/lint/lint-unnecessary-parens.stderr b/tests/ui/lint/lint-unnecessary-parens.stderr
index 2ad07530f..ba7a78b8d 100644
--- a/tests/ui/lint/lint-unnecessary-parens.stderr
+++ b/tests/ui/lint/lint-unnecessary-parens.stderr
@@ -267,5 +267,77 @@ LL - _a += (1);
LL + _a += 1;
|
-error: aborting due to 22 previous errors
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:87:8
+ |
+LL | let(mut _a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let(mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:88:9
+ |
+LL | let (mut _a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let (mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:89:8
+ |
+LL | let( mut _a) = 3;
+ | ^^ ^
+ |
+help: remove these parentheses
+ |
+LL - let( mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:91:8
+ |
+LL | let(_a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let(_a) = 3;
+LL + let _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:92:9
+ |
+LL | let (_a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let (_a) = 3;
+LL + let _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:93:8
+ |
+LL | let( _a) = 3;
+ | ^^ ^
+ |
+help: remove these parentheses
+ |
+LL - let( _a) = 3;
+LL + let _a = 3;
+ |
+
+error: aborting due to 28 previous errors
diff --git a/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs b/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs
new file mode 100644
index 000000000..2d5e90720
--- /dev/null
+++ b/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs
@@ -0,0 +1,25 @@
+// Test for issue #116766.
+// Ensure that we don't suggest impl'ing `Copy` for a type if it or at least one
+// of it's variants are marked as `non_exhaustive`.
+
+// check-pass
+
+#![deny(missing_copy_implementations)]
+
+#[non_exhaustive]
+pub enum MyEnum {
+ A,
+}
+
+#[non_exhaustive]
+pub struct MyStruct {
+ foo: usize,
+}
+
+pub enum MyEnum2 {
+ #[non_exhaustive]
+ A,
+ B,
+}
+
+fn main() {}
diff --git a/tests/ui/lint/must_not_suspend/gated.stderr b/tests/ui/lint/must_not_suspend/gated.stderr
index 64de1ebea..f0d2117d4 100644
--- a/tests/ui/lint/must_not_suspend/gated.stderr
+++ b/tests/ui/lint/must_not_suspend/gated.stderr
@@ -18,6 +18,7 @@ LL | #![deny(must_not_suspend)]
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `must_not_suspend`
--> $DIR/gated.rs:4:1
@@ -28,6 +29,7 @@ LL | #![deny(must_not_suspend)]
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/must_not_suspend/tuple-mismatch.rs b/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
index c7e14e425..2f3c5d9ea 100644
--- a/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
+++ b/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
- let _generator = || {
+ let _coroutine = || {
yield ((), ((), ()));
yield ((), ());
//~^ ERROR mismatched types
diff --git a/tests/ui/lint/reasons-erroneous.rs b/tests/ui/lint/reasons-erroneous.rs
index cd693ae16..7b286eb1d 100644
--- a/tests/ui/lint/reasons-erroneous.rs
+++ b/tests/ui/lint/reasons-erroneous.rs
@@ -1,51 +1,27 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(lint_reasons)]
#![warn(absolute_paths_not_starting_with_crate, reason = 0)]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason must be a string literal
//~| NOTE reason must be a string literal
#![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason must be a string literal
//~| NOTE reason must be a string literal
#![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason in lint attribute must come last
//~| NOTE reason in lint attribute must come last
#![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason in lint attribute must come last
//~| NOTE reason in lint attribute must come last
#![warn(missing_copy_implementations, reason)]
//~^ WARN unknown lint
diff --git a/tests/ui/lint/reasons-erroneous.stderr b/tests/ui/lint/reasons-erroneous.stderr
index 5521af17c..003da5673 100644
--- a/tests/ui/lint/reasons-erroneous.stderr
+++ b/tests/ui/lint/reasons-erroneous.stderr
@@ -1,5 +1,5 @@
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:3:58
+ --> $DIR/reasons-erroneous.rs:5:58
|
LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)]
| ^ reason must be a string literal
@@ -11,121 +11,43 @@ LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condem
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
+ --> $DIR/reasons-erroneous.rs:11:29
|
LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:40:44
- |
-LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
- | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:45:25
- |
-LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:3:58
- |
-LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)]
- | ^ reason must be a string literal
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:8:40
- |
-LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
+ --> $DIR/reasons-erroneous.rs:14:23
|
LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
+ --> $DIR/reasons-erroneous.rs:17:36
|
LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:40:44
+ --> $DIR/reasons-erroneous.rs:20:44
|
LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
| ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:45:25
+ --> $DIR/reasons-erroneous.rs:23:25
|
LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
warning: unknown lint: `reason`
- --> $DIR/reasons-erroneous.rs:50:39
+ --> $DIR/reasons-erroneous.rs:26:39
|
LL | #![warn(missing_copy_implementations, reason)]
| ^^^^^^
|
= note: `#[warn(unknown_lints)]` on by default
-error: aborting due to 20 previous errors; 1 warning emitted
+error: aborting due to 7 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0452`.
diff --git a/tests/ui/lint/reference_casting.rs b/tests/ui/lint/reference_casting.rs
index fba8789e9..25e0c75f7 100644
--- a/tests/ui/lint/reference_casting.rs
+++ b/tests/ui/lint/reference_casting.rs
@@ -64,6 +64,10 @@ unsafe fn ref_to_mut() {
let _num = &mut *num;
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let cell = &std::cell::UnsafeCell::new(0);
+ let _num = &mut *(cell as *const _ as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+
unsafe fn generic_ref_cast_mut<T>(this: &T) -> &mut T {
&mut *((this as *const _) as *mut _)
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
@@ -106,6 +110,8 @@ unsafe fn assign_to_ref() {
std::mem::transmute::<*const i32, *mut i32>(num),
-1i32,
);
+ *((&std::cell::UnsafeCell::new(0)) as *const _ as *mut i32) = 5;
+ //~^ ERROR assigning to `&T` is undefined behavior
let value = num as *const i32 as *mut i32;
*value = 1;
@@ -148,6 +154,8 @@ unsafe fn no_warn() {
*RAW_PTR = 42; // RAW_PTR is defined outside the function body,
// make sure we don't ICE on it when trying to
// determine if we should lint on it or not.
+ let cell = &std::cell::UnsafeCell::new(0);
+ let _num = &mut *(cell.get() as *mut i32);
fn safe_as_mut<T>(x: &std::cell::UnsafeCell<T>) -> &mut T {
unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
diff --git a/tests/ui/lint/reference_casting.stderr b/tests/ui/lint/reference_casting.stderr
index 8f89cf980..8d5f8da68 100644
--- a/tests/ui/lint/reference_casting.stderr
+++ b/tests/ui/lint/reference_casting.stderr
@@ -158,7 +158,16 @@ LL | let _num = &mut *num;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:68:9
+ --> $DIR/reference_casting.rs:68:16
+ |
+LL | let _num = &mut *(cell as *const _ as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+ = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:72:9
|
LL | &mut *((this as *const _) as *mut _)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -166,7 +175,7 @@ LL | &mut *((this as *const _) as *mut _)
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:73:18
+ --> $DIR/reference_casting.rs:77:18
|
LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -174,7 +183,7 @@ LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *con
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:78:18
+ --> $DIR/reference_casting.rs:82:18
|
LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -182,7 +191,7 @@ LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *con
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:88:5
+ --> $DIR/reference_casting.rs:92:5
|
LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -190,7 +199,7 @@ LL | *(a as *const _ as *mut _) = String::from("Replaced");
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:90:5
+ --> $DIR/reference_casting.rs:94:5
|
LL | *(a as *const _ as *mut String) += " world";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -198,7 +207,7 @@ LL | *(a as *const _ as *mut String) += " world";
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:92:5
+ --> $DIR/reference_casting.rs:96:5
|
LL | *std::ptr::from_ref(num).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -206,7 +215,7 @@ LL | *std::ptr::from_ref(num).cast_mut() += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:94:5
+ --> $DIR/reference_casting.rs:98:5
|
LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -214,7 +223,7 @@ LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:96:5
+ --> $DIR/reference_casting.rs:100:5
|
LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -222,7 +231,7 @@ LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:98:5
+ --> $DIR/reference_casting.rs:102:5
|
LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -230,7 +239,7 @@ LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:100:5
+ --> $DIR/reference_casting.rs:104:5
|
LL | *std::mem::transmute::<_, *mut i32>(num) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -238,7 +247,7 @@ LL | *std::mem::transmute::<_, *mut i32>(num) += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:102:5
+ --> $DIR/reference_casting.rs:106:5
|
LL | *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -246,7 +255,7 @@ LL | *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:104:5
+ --> $DIR/reference_casting.rs:108:5
|
LL | / std::ptr::write(
LL | |
@@ -258,7 +267,16 @@ LL | | );
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:111:5
+ --> $DIR/reference_casting.rs:113:5
+ |
+LL | *((&std::cell::UnsafeCell::new(0)) as *const _ as *mut i32) = 5;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+ = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:117:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -268,7 +286,7 @@ LL | *value = 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:114:5
+ --> $DIR/reference_casting.rs:120:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -279,7 +297,7 @@ LL | *value_rebind = 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:116:5
+ --> $DIR/reference_casting.rs:122:5
|
LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -287,7 +305,7 @@ LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:118:5
+ --> $DIR/reference_casting.rs:124:5
|
LL | *(num as *const _ as usize as *mut i32) = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -295,7 +313,7 @@ LL | *(num as *const _ as usize as *mut i32) = 2;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:120:5
+ --> $DIR/reference_casting.rs:126:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -306,7 +324,7 @@ LL | std::ptr::write(value, 2);
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:122:5
+ --> $DIR/reference_casting.rs:128:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -317,7 +335,7 @@ LL | std::ptr::write_unaligned(value, 2);
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:124:5
+ --> $DIR/reference_casting.rs:130:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -328,12 +346,12 @@ LL | std::ptr::write_volatile(value, 2);
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:128:9
+ --> $DIR/reference_casting.rs:134:9
|
LL | *(this as *const _ as *mut _) = a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
-error: aborting due to 38 previous errors
+error: aborting due to 40 previous errors
diff --git a/tests/ui/lint/register-tool-lint.stderr b/tests/ui/lint/register-tool-lint.stderr
index 842d845ff..7ebdbdec9 100644
--- a/tests/ui/lint/register-tool-lint.stderr
+++ b/tests/ui/lint/register-tool-lint.stderr
@@ -13,6 +13,7 @@ LL | #![warn(abc::my_lint)]
| ^^^
|
= help: add `#![register_tool(abc)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs
new file mode 100644
index 000000000..1e2ff12a2
--- /dev/null
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs
@@ -0,0 +1,30 @@
+// check-pass
+// incremental
+
+#![feature(lint_reasons)]
+#![warn(unused)]
+
+struct OneUnused;
+struct TwoUnused;
+
+impl OneUnused {
+ #[expect(unused)]
+ fn unused() {}
+}
+
+impl TwoUnused {
+ #[expect(unused)]
+ fn unused1(){}
+
+ // This unused method has `#[expect(unused)]`, so the compiler should not emit a warning.
+ // This ui test was added after a regression in the compiler where it did not recognize multiple
+ // `#[expect(unused)]` annotations inside of impl blocks.
+ // issue 114416
+ #[expect(unused)]
+ fn unused2(){}
+}
+
+fn main() {
+ let _ = OneUnused;
+ let _ = TwoUnused;
+}
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
index 479ee198e..77cb5e88b 100644
--- a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
@@ -1,24 +1,20 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(lint_reasons)]
#[forbid(unused_variables)]
//~^ NOTE `forbid` level set here
-//~| NOTE `forbid` level set here
#[expect(unused_variables)]
//~^ ERROR incompatible with previous forbid [E0453]
//~| NOTE overruled by previous forbid
-//~| ERROR incompatible with previous forbid [E0453]
-//~| NOTE overruled by previous forbid
fn expect_forbidden_lint_1() {}
#[forbid(while_true)]
//~^ NOTE `forbid` level set here
-//~| NOTE `forbid` level set here
//~| NOTE the lint level is defined here
#[expect(while_true)]
//~^ ERROR incompatible with previous forbid [E0453]
//~| NOTE overruled by previous forbid
-//~| ERROR incompatible with previous forbid [E0453]
-//~| NOTE overruled by previous forbid
fn expect_forbidden_lint_2() {
// This while loop will produce a `while_true` lint as the lint level
// at this node is still `forbid` and the `while_true` check happens
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
index a8116e934..0f42ffbde 100644
--- a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
@@ -1,32 +1,14 @@
error[E0453]: expect(unused_variables) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:6:10
+ --> $DIR/expect_with_forbid.rs:7:10
|
LL | #[forbid(unused_variables)]
| ---------------- `forbid` level set here
-...
-LL | #[expect(unused_variables)]
- | ^^^^^^^^^^^^^^^^ overruled by previous forbid
-
-error[E0453]: expect(while_true) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:17:10
- |
-LL | #[forbid(while_true)]
- | ---------- `forbid` level set here
-...
-LL | #[expect(while_true)]
- | ^^^^^^^^^^ overruled by previous forbid
-
-error[E0453]: expect(unused_variables) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:6:10
- |
-LL | #[forbid(unused_variables)]
- | ---------------- `forbid` level set here
-...
+LL |
LL | #[expect(unused_variables)]
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
error[E0453]: expect(while_true) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:17:10
+ --> $DIR/expect_with_forbid.rs:15:10
|
LL | #[forbid(while_true)]
| ---------- `forbid` level set here
@@ -35,17 +17,17 @@ LL | #[expect(while_true)]
| ^^^^^^^^^^ overruled by previous forbid
error: denote infinite loops with `loop { ... }`
- --> $DIR/expect_with_forbid.rs:26:5
+ --> $DIR/expect_with_forbid.rs:22:5
|
LL | while true {}
| ^^^^^^^^^^ help: use `loop`
|
note: the lint level is defined here
- --> $DIR/expect_with_forbid.rs:13:10
+ --> $DIR/expect_with_forbid.rs:12:10
|
LL | #[forbid(while_true)]
| ^^^^^^^^^^
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0453`.
diff --git a/tests/ui/lint/unaligned_references.rs b/tests/ui/lint/unaligned_references.rs
index 0c9c79c08..3f6dab354 100644
--- a/tests/ui/lint/unaligned_references.rs
+++ b/tests/ui/lint/unaligned_references.rs
@@ -1,3 +1,6 @@
+use std::mem::ManuallyDrop;
+use std::fmt::Debug;
+
#[repr(packed)]
pub struct Good {
data: u64,
@@ -27,6 +30,26 @@ impl Foo for Packed2 {
}
}
+// Test for #115396
+fn packed_dyn() {
+ #[repr(packed)]
+ struct Unaligned<T: ?Sized>(ManuallyDrop<T>);
+
+ let ref local = Unaligned(ManuallyDrop::new([3, 5, 8u64]));
+ let foo: &Unaligned<dyn Debug> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+ let foo: &Unaligned<[u64]> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+
+ // Even if the actual alignment is 1, we cannot know that when looking at `dyn Debug.`
+ let ref local = Unaligned(ManuallyDrop::new([3, 5, 8u8]));
+ let foo: &Unaligned<dyn Debug> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+ // However, we *can* know the alignment when looking at a slice.
+ let foo: &Unaligned<[u8]> = &*local;
+ println!("{:?}", &*foo.0); // no error!
+}
+
fn main() {
unsafe {
let good = Good { data: 0, ptr: &0, data2: [0, 0], aligned: [0; 32] };
diff --git a/tests/ui/lint/unaligned_references.stderr b/tests/ui/lint/unaligned_references.stderr
index d3abc3766..328cafbd9 100644
--- a/tests/ui/lint/unaligned_references.stderr
+++ b/tests/ui/lint/unaligned_references.stderr
@@ -1,5 +1,5 @@
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:25:13
+ --> $DIR/unaligned_references.rs:28:13
|
LL | &self.x;
| ^^^^^^^
@@ -9,7 +9,37 @@ LL | &self.x;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:34:17
+ --> $DIR/unaligned_references.rs:40:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:42:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:47:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:57:17
|
LL | let _ = &good.ptr;
| ^^^^^^^^^
@@ -19,7 +49,7 @@ LL | let _ = &good.ptr;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:35:17
+ --> $DIR/unaligned_references.rs:58:17
|
LL | let _ = &good.data;
| ^^^^^^^^^^
@@ -29,7 +59,7 @@ LL | let _ = &good.data;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:37:17
+ --> $DIR/unaligned_references.rs:60:17
|
LL | let _ = &good.data as *const _;
| ^^^^^^^^^^
@@ -39,7 +69,7 @@ LL | let _ = &good.data as *const _;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:38:27
+ --> $DIR/unaligned_references.rs:61:27
|
LL | let _: *const _ = &good.data;
| ^^^^^^^^^^
@@ -49,7 +79,7 @@ LL | let _: *const _ = &good.data;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:40:17
+ --> $DIR/unaligned_references.rs:63:17
|
LL | let _ = good.data.clone();
| ^^^^^^^^^
@@ -59,7 +89,7 @@ LL | let _ = good.data.clone();
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:42:17
+ --> $DIR/unaligned_references.rs:65:17
|
LL | let _ = &good.data2[0];
| ^^^^^^^^^^^^^^
@@ -69,7 +99,7 @@ LL | let _ = &good.data2[0];
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:51:17
+ --> $DIR/unaligned_references.rs:74:17
|
LL | let _ = &packed2.x;
| ^^^^^^^^^^
@@ -79,7 +109,7 @@ LL | let _ = &packed2.x;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:90:20
+ --> $DIR/unaligned_references.rs:113:20
|
LL | let _ref = &m1.1.a;
| ^^^^^^^
@@ -89,7 +119,7 @@ LL | let _ref = &m1.1.a;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:93:20
+ --> $DIR/unaligned_references.rs:116:20
|
LL | let _ref = &m2.1.a;
| ^^^^^^^
@@ -98,6 +128,6 @@ LL | let _ref = &m2.1.a;
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
-error: aborting due to 10 previous errors
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0793`.
diff --git a/tests/ui/lint/unused/issue-117284-arg-in-macro.rs b/tests/ui/lint/unused/issue-117284-arg-in-macro.rs
new file mode 100644
index 000000000..eea0f4c59
--- /dev/null
+++ b/tests/ui/lint/unused/issue-117284-arg-in-macro.rs
@@ -0,0 +1,17 @@
+#![deny(unused_variables)]
+macro_rules! make_var {
+ ($struct:ident, $var:ident) => {
+ let $var = $struct.$var;
+ };
+}
+
+#[allow(unused)]
+struct MyStruct {
+ var: i32,
+}
+
+fn main() {
+ let s = MyStruct { var: 42 };
+ make_var!(s, var); //~ ERROR unused variable: `var`
+ let a = 1; //~ ERROR unused variable: `a`
+}
diff --git a/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr
new file mode 100644
index 000000000..84efaa4f3
--- /dev/null
+++ b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr
@@ -0,0 +1,29 @@
+error: unused variable: `var`
+ --> $DIR/issue-117284-arg-in-macro.rs:15:18
+ |
+LL | make_var!(s, var);
+ | ^^^
+ |
+help: `var` is captured in macro and introduced a unused variable
+ --> $DIR/issue-117284-arg-in-macro.rs:4:13
+ |
+LL | let $var = $struct.$var;
+ | ^^^^
+...
+LL | make_var!(s, var);
+ | ----------------- in this macro invocation
+note: the lint level is defined here
+ --> $DIR/issue-117284-arg-in-macro.rs:1:9
+ |
+LL | #![deny(unused_variables)]
+ | ^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `make_var` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: unused variable: `a`
+ --> $DIR/issue-117284-arg-in-macro.rs:16:9
+ |
+LL | let a = 1;
+ | ^ help: if this is intentional, prefix it with an underscore: `_a`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs b/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
index 8064c3a88..c5dd281cb 100644
--- a/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
+++ b/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
@@ -1,8 +1,8 @@
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
#![deny(unused_braces, unused_parens)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/lint/unused/lint-unused-imports.rs b/tests/ui/lint/unused/lint-unused-imports.rs
index 953992ecf..4fa6511c9 100644
--- a/tests/ui/lint/unused/lint-unused-imports.rs
+++ b/tests/ui/lint/unused/lint-unused-imports.rs
@@ -42,7 +42,7 @@ mod foo {
pub struct Square{pub p: Point, pub h: usize, pub w: usize}
}
-mod bar {
+pub mod bar {
// Don't ignore on 'pub use' because we're not sure if it's used or not
pub use std::cmp::PartialEq;
pub struct Square;
diff --git a/tests/ui/lint/unused/unused-closure.rs b/tests/ui/lint/unused/unused-closure.rs
index c96c90731..12ee8b3a9 100644
--- a/tests/ui/lint/unused/unused-closure.rs
+++ b/tests/ui/lint/unused/unused-closure.rs
@@ -1,8 +1,8 @@
-// Test that closures and generators are "must use" types.
+// Test that closures and coroutines are "must use" types.
// edition:2018
#![feature(async_closure)]
-#![feature(generators)]
+#![feature(coroutines)]
#![deny(unused_must_use)]
fn unused() {