about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/doctests-keep-binaries-2024/rmake.rs17
-rw-r--r--tests/rustdoc-ui/doctest/dead-code-items.rs116
-rw-r--r--tests/rustdoc-ui/doctest/dead-code-items.stdout146
-rw-r--r--tests/rustdoc-ui/doctest/dead-code-module-2.rs27
-rw-r--r--tests/rustdoc-ui/doctest/dead-code-module-2.stdout35
-rw-r--r--tests/rustdoc-ui/doctest/dead-code-module.rs18
-rw-r--r--tests/rustdoc-ui/doctest/dead-code-module.stdout29
-rw-r--r--tests/rustdoc-ui/doctest/doc-test-attr-pass-module.rs11
-rw-r--r--tests/ui/asm/x86_64/evex512-implicit-feature.rs2
-rw-r--r--tests/ui/future-incompatible-lint-group.rs10
-rw-r--r--tests/ui/future-incompatible-lint-group.stderr40
-rw-r--r--tests/ui/lint/force-warn/ice-free.rs9
-rw-r--r--tests/ui/lint/force-warn/ice-free.stderr32
-rw-r--r--tests/ui/lint/implicit_autorefs.fixed53
-rw-r--r--tests/ui/lint/implicit_autorefs.rs53
-rw-r--r--tests/ui/lint/implicit_autorefs.stderr84
-rw-r--r--tests/ui/lint/unused/useless-comment.rs7
-rw-r--r--tests/ui/lint/unused/useless-comment.stderr73
-rw-r--r--tests/ui/rustdoc/doc-test-attr-pass.rs42
-rw-r--r--tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs (renamed from tests/crashes/140571.rs)11
-rw-r--r--tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr21
21 files changed, 714 insertions, 122 deletions
diff --git a/tests/run-make/doctests-keep-binaries-2024/rmake.rs b/tests/run-make/doctests-keep-binaries-2024/rmake.rs
index 3e8ffcbf244..97324e1dcbc 100644
--- a/tests/run-make/doctests-keep-binaries-2024/rmake.rs
+++ b/tests/run-make/doctests-keep-binaries-2024/rmake.rs
@@ -16,7 +16,22 @@ fn setup_test_env<F: FnOnce(&Path, &Path)>(callback: F) {
 }
 
 fn check_generated_binaries() {
-    run("doctests/merged_doctest_2024/rust_out");
+    let mut found_merged_doctest = false;
+    rfs::read_dir_entries("doctests/", |path| {
+        if path
+            .file_name()
+            .and_then(|name| name.to_str())
+            .is_some_and(|name| name.starts_with("merged_doctest_2024"))
+        {
+            found_merged_doctest = true;
+            let rust_out = path.join("rust_out");
+            let rust_out = rust_out.to_string_lossy();
+            run(&*rust_out);
+        }
+    });
+    if !found_merged_doctest {
+        panic!("no directory starting with `merged_doctest_2024` found under `doctests/`");
+    }
 }
 
 fn main() {
diff --git a/tests/rustdoc-ui/doctest/dead-code-items.rs b/tests/rustdoc-ui/doctest/dead-code-items.rs
new file mode 100644
index 00000000000..015504cbced
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/dead-code-items.rs
@@ -0,0 +1,116 @@
+// Same test as dead-code-module but with 2 doc(test(attr())) at different levels.
+
+//@ edition: 2024
+//@ compile-flags:--test --test-args=--test-threads=1
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ failure-status: 101
+
+#![doc(test(attr(deny(warnings))))]
+
+#[doc(test(attr(allow(dead_code))))]
+/// Example
+///
+/// ```rust,no_run
+/// trait OnlyWarning { fn no_deny_warnings(); }
+/// ```
+static S: u32 = 5;
+
+#[doc(test(attr(allow(dead_code))))]
+/// Example
+///
+/// ```rust,no_run
+/// let unused_error = 5;
+///
+/// fn dead_code_but_no_error() {}
+/// ```
+const C: u32 = 5;
+
+#[doc(test(attr(allow(dead_code))))]
+/// Example
+///
+/// ```rust,no_run
+/// trait OnlyWarningAtA { fn no_deny_warnings(); }
+/// ```
+struct A {
+    #[doc(test(attr(deny(dead_code))))]
+    /// Example
+    ///
+    /// ```rust,no_run
+    /// trait DeadCodeInField {}
+    /// ```
+    field: u32
+}
+
+#[doc(test(attr(allow(dead_code))))]
+/// Example
+///
+/// ```rust,no_run
+/// trait OnlyWarningAtU { fn no_deny_warnings(); }
+/// ```
+union U {
+    #[doc(test(attr(deny(dead_code))))]
+    /// Example
+    ///
+    /// ```rust,no_run
+    /// trait DeadCodeInUnionField {}
+    /// ```
+    field: u32,
+    /// Example
+    ///
+    /// ```rust,no_run
+    /// trait NotDeadCodeInUnionField {}
+    /// ```
+    field2: u64,
+}
+
+#[doc(test(attr(deny(dead_code))))]
+/// Example
+///
+/// ```rust,no_run
+/// let not_dead_code_but_unused = 5;
+/// ```
+enum Enum {
+    #[doc(test(attr(allow(dead_code))))]
+    /// Example
+    ///
+    /// ```rust,no_run
+    /// trait NotDeadCodeInVariant {}
+    ///
+    /// fn main() { let unused_in_variant = 5; }
+    /// ```
+    Variant1,
+}
+
+#[doc(test(attr(allow(dead_code))))]
+/// Example
+///
+/// ```rust,no_run
+/// trait OnlyWarningAtImplA { fn no_deny_warnings(); }
+/// ```
+impl A {
+    /// Example
+    ///
+    /// ```rust,no_run
+    /// trait NotDeadCodeInImplMethod {}
+    /// ```
+    fn method() {}
+}
+
+#[doc(test(attr(deny(dead_code))))]
+/// Example
+///
+/// ```rust,no_run
+/// trait StillDeadCodeAtMyTrait { }
+/// ```
+trait MyTrait {
+    #[doc(test(attr(allow(dead_code))))]
+    /// Example
+    ///
+    /// ```rust,no_run
+    /// trait NotDeadCodeAtImplFn {}
+    ///
+    /// fn main() { let unused_in_impl = 5; }
+    /// ```
+    fn my_trait_fn();
+}
diff --git a/tests/rustdoc-ui/doctest/dead-code-items.stdout b/tests/rustdoc-ui/doctest/dead-code-items.stdout
new file mode 100644
index 00000000000..4b9d8be94dd
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/dead-code-items.stdout
@@ -0,0 +1,146 @@
+
+running 13 tests
+test $DIR/dead-code-items.rs - A (line 32) - compile ... ok
+test $DIR/dead-code-items.rs - A (line 88) - compile ... ok
+test $DIR/dead-code-items.rs - A::field (line 39) - compile ... FAILED
+test $DIR/dead-code-items.rs - A::method (line 94) - compile ... ok
+test $DIR/dead-code-items.rs - C (line 22) - compile ... FAILED
+test $DIR/dead-code-items.rs - Enum (line 70) - compile ... FAILED
+test $DIR/dead-code-items.rs - Enum::Variant1 (line 77) - compile ... FAILED
+test $DIR/dead-code-items.rs - MyTrait (line 103) - compile ... FAILED
+test $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 110) - compile ... FAILED
+test $DIR/dead-code-items.rs - S (line 14) - compile ... ok
+test $DIR/dead-code-items.rs - U (line 48) - compile ... ok
+test $DIR/dead-code-items.rs - U::field (line 55) - compile ... FAILED
+test $DIR/dead-code-items.rs - U::field2 (line 61) - compile ... ok
+
+failures:
+
+---- $DIR/dead-code-items.rs - A::field (line 39) stdout ----
+error: trait `DeadCodeInField` is never used
+  --> $DIR/dead-code-items.rs:40:7
+   |
+LL | trait DeadCodeInField {}
+   |       ^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-items.rs:38:9
+   |
+LL | #![deny(dead_code)]
+   |         ^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+---- $DIR/dead-code-items.rs - C (line 22) stdout ----
+error: unused variable: `unused_error`
+  --> $DIR/dead-code-items.rs:23:5
+   |
+LL | let unused_error = 5;
+   |     ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused_error`
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-items.rs:20:9
+   |
+LL | #![deny(warnings)]
+   |         ^^^^^^^^
+   = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+---- $DIR/dead-code-items.rs - Enum (line 70) stdout ----
+error: unused variable: `not_dead_code_but_unused`
+  --> $DIR/dead-code-items.rs:71:5
+   |
+LL | let not_dead_code_but_unused = 5;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_not_dead_code_but_unused`
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-items.rs:68:9
+   |
+LL | #![deny(warnings)]
+   |         ^^^^^^^^
+   = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+---- $DIR/dead-code-items.rs - Enum::Variant1 (line 77) stdout ----
+error: unused variable: `unused_in_variant`
+  --> $DIR/dead-code-items.rs:80:17
+   |
+LL | fn main() { let unused_in_variant = 5; }
+   |                 ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused_in_variant`
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-items.rs:75:9
+   |
+LL | #![deny(warnings)]
+   |         ^^^^^^^^
+   = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+---- $DIR/dead-code-items.rs - MyTrait (line 103) stdout ----
+error: trait `StillDeadCodeAtMyTrait` is never used
+  --> $DIR/dead-code-items.rs:104:7
+   |
+LL | trait StillDeadCodeAtMyTrait { }
+   |       ^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-items.rs:102:9
+   |
+LL | #![deny(dead_code)]
+   |         ^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+---- $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 110) stdout ----
+error: unused variable: `unused_in_impl`
+  --> $DIR/dead-code-items.rs:113:17
+   |
+LL | fn main() { let unused_in_impl = 5; }
+   |                 ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused_in_impl`
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-items.rs:108:9
+   |
+LL | #![deny(warnings)]
+   |         ^^^^^^^^
+   = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+---- $DIR/dead-code-items.rs - U::field (line 55) stdout ----
+error: trait `DeadCodeInUnionField` is never used
+  --> $DIR/dead-code-items.rs:56:7
+   |
+LL | trait DeadCodeInUnionField {}
+   |       ^^^^^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-items.rs:54:9
+   |
+LL | #![deny(dead_code)]
+   |         ^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+
+failures:
+    $DIR/dead-code-items.rs - A::field (line 39)
+    $DIR/dead-code-items.rs - C (line 22)
+    $DIR/dead-code-items.rs - Enum (line 70)
+    $DIR/dead-code-items.rs - Enum::Variant1 (line 77)
+    $DIR/dead-code-items.rs - MyTrait (line 103)
+    $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 110)
+    $DIR/dead-code-items.rs - U::field (line 55)
+
+test result: FAILED. 6 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/rustdoc-ui/doctest/dead-code-module-2.rs b/tests/rustdoc-ui/doctest/dead-code-module-2.rs
new file mode 100644
index 00000000000..de7b11b91ec
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/dead-code-module-2.rs
@@ -0,0 +1,27 @@
+// Same test as dead-code-module but with 2 doc(test(attr())) at different levels.
+
+//@ edition: 2024
+//@ compile-flags:--test
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ failure-status: 101
+
+#![doc(test(attr(allow(unused_variables))))]
+
+mod my_mod {
+    #![doc(test(attr(deny(warnings))))]
+
+    /// Example
+    ///
+    /// ```rust,no_run
+    /// trait T { fn f(); }
+    /// ```
+    pub fn f() {}
+}
+
+/// Example
+///
+/// ```rust,no_run
+/// trait OnlyWarning { fn no_deny_warnings(); }
+/// ```
+pub fn g() {}
diff --git a/tests/rustdoc-ui/doctest/dead-code-module-2.stdout b/tests/rustdoc-ui/doctest/dead-code-module-2.stdout
new file mode 100644
index 00000000000..d44068dcbf5
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/dead-code-module-2.stdout
@@ -0,0 +1,35 @@
+
+running 1 test
+test $DIR/dead-code-module-2.rs - g (line 24) - compile ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
+
+running 1 test
+test $DIR/dead-code-module-2.rs - my_mod::f (line 16) - compile ... FAILED
+
+failures:
+
+---- $DIR/dead-code-module-2.rs - my_mod::f (line 16) stdout ----
+error: trait `T` is never used
+  --> $DIR/dead-code-module-2.rs:17:7
+   |
+LL | trait T { fn f(); }
+   |       ^
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-module-2.rs:15:9
+   |
+LL | #![deny(warnings)]
+   |         ^^^^^^^^
+   = note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+
+failures:
+    $DIR/dead-code-module-2.rs - my_mod::f (line 16)
+
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/rustdoc-ui/doctest/dead-code-module.rs b/tests/rustdoc-ui/doctest/dead-code-module.rs
new file mode 100644
index 00000000000..f825749a6a2
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/dead-code-module.rs
@@ -0,0 +1,18 @@
+// Same test as dead-code but inside a module.
+
+//@ edition: 2024
+//@ compile-flags:--test
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ failure-status: 101
+
+mod my_mod {
+    #![doc(test(attr(allow(unused_variables), deny(warnings))))]
+
+    /// Example
+    ///
+    /// ```rust,no_run
+    /// trait T { fn f(); }
+    /// ```
+    pub fn f() {}
+}
diff --git a/tests/rustdoc-ui/doctest/dead-code-module.stdout b/tests/rustdoc-ui/doctest/dead-code-module.stdout
new file mode 100644
index 00000000000..b5ccf225d25
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/dead-code-module.stdout
@@ -0,0 +1,29 @@
+
+running 1 test
+test $DIR/dead-code-module.rs - my_mod::f (line 14) - compile ... FAILED
+
+failures:
+
+---- $DIR/dead-code-module.rs - my_mod::f (line 14) stdout ----
+error: trait `T` is never used
+  --> $DIR/dead-code-module.rs:15:7
+   |
+LL | trait T { fn f(); }
+   |       ^
+   |
+note: the lint level is defined here
+  --> $DIR/dead-code-module.rs:13:9
+   |
+LL | #![deny(warnings)]
+   |         ^^^^^^^^
+   = note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+
+failures:
+    $DIR/dead-code-module.rs - my_mod::f (line 14)
+
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/rustdoc-ui/doctest/doc-test-attr-pass-module.rs b/tests/rustdoc-ui/doctest/doc-test-attr-pass-module.rs
new file mode 100644
index 00000000000..e916ca41ea0
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/doc-test-attr-pass-module.rs
@@ -0,0 +1,11 @@
+//@ check-pass
+
+#![crate_type = "lib"]
+#![deny(invalid_doc_attributes)]
+#![doc(test(no_crate_inject))]
+
+mod my_mod {
+    #![doc(test(attr(deny(warnings))))]
+
+    pub fn foo() {}
+}
diff --git a/tests/ui/asm/x86_64/evex512-implicit-feature.rs b/tests/ui/asm/x86_64/evex512-implicit-feature.rs
index ec5da7c7fa4..1f678b2387a 100644
--- a/tests/ui/asm/x86_64/evex512-implicit-feature.rs
+++ b/tests/ui/asm/x86_64/evex512-implicit-feature.rs
@@ -2,8 +2,6 @@
 //@ only-x86_64
 //@ compile-flags: --crate-type=lib -C target-cpu=skylake
 
-#![feature(stdarch_x86_avx512)]
-
 use std::arch::x86_64::*;
 
 #[target_feature(enable = "avx512f")]
diff --git a/tests/ui/future-incompatible-lint-group.rs b/tests/ui/future-incompatible-lint-group.rs
index c84538318f7..ed2c47bb609 100644
--- a/tests/ui/future-incompatible-lint-group.rs
+++ b/tests/ui/future-incompatible-lint-group.rs
@@ -2,16 +2,14 @@
 // lints for changes that are not tied to an edition
 #![deny(future_incompatible)]
 
+// Error since this is a `future_incompatible` lint
+macro_rules! m { ($i) => {} } //~ ERROR missing fragment specifier
+                              //~| WARN this was previously accepted
+
 trait Tr {
     // Warn only since this is not a `future_incompatible` lint
     fn f(u8) {} //~ WARN anonymous parameters are deprecated
                 //~| WARN this is accepted in the current edition
 }
 
-pub mod submodule {
-    // Error since this is a `future_incompatible` lint
-    #![doc(test(some_test))]
-    //~^ ERROR this attribute can only be applied at the crate level
-}
-
 fn main() {}
diff --git a/tests/ui/future-incompatible-lint-group.stderr b/tests/ui/future-incompatible-lint-group.stderr
index 4e6c434fa29..4c867e0aab3 100644
--- a/tests/ui/future-incompatible-lint-group.stderr
+++ b/tests/ui/future-incompatible-lint-group.stderr
@@ -1,5 +1,20 @@
+error: missing fragment specifier
+  --> $DIR/future-incompatible-lint-group.rs:6:19
+   |
+LL | macro_rules! m { ($i) => {} }
+   |                   ^^
+   |
+   = 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 #40107 <https://github.com/rust-lang/rust/issues/40107>
+note: the lint level is defined here
+  --> $DIR/future-incompatible-lint-group.rs:3:9
+   |
+LL | #![deny(future_incompatible)]
+   |         ^^^^^^^^^^^^^^^^^^^
+   = note: `#[deny(missing_fragment_specifier)]` implied by `#[deny(future_incompatible)]`
+
 warning: anonymous parameters are deprecated and will be removed in the next edition
-  --> $DIR/future-incompatible-lint-group.rs:7:10
+  --> $DIR/future-incompatible-lint-group.rs:11:10
    |
 LL |     fn f(u8) {}
    |          ^^ help: try naming the parameter or explicitly ignoring it: `_: u8`
@@ -8,14 +23,21 @@ LL |     fn f(u8) {}
    = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
    = note: `#[warn(anonymous_parameters)]` on by default
 
-error: this attribute can only be applied at the crate level
-  --> $DIR/future-incompatible-lint-group.rs:13:12
+error: aborting due to 1 previous error; 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+error: missing fragment specifier
+  --> $DIR/future-incompatible-lint-group.rs:6:19
    |
-LL |     #![doc(test(some_test))]
-   |            ^^^^^^^^^^^^^^^
+LL | macro_rules! m { ($i) => {} }
+   |                   ^^
    |
-   = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
-   = note: `#[deny(invalid_doc_attributes)]` on by default
-
-error: aborting due to 1 previous error; 1 warning emitted
+   = 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 #40107 <https://github.com/rust-lang/rust/issues/40107>
+note: the lint level is defined here
+  --> $DIR/future-incompatible-lint-group.rs:3:9
+   |
+LL | #![deny(future_incompatible)]
+   |         ^^^^^^^^^^^^^^^^^^^
+   = note: `#[deny(missing_fragment_specifier)]` implied by `#[deny(future_incompatible)]`
 
diff --git a/tests/ui/lint/force-warn/ice-free.rs b/tests/ui/lint/force-warn/ice-free.rs
new file mode 100644
index 00000000000..99b79f44648
--- /dev/null
+++ b/tests/ui/lint/force-warn/ice-free.rs
@@ -0,0 +1,9 @@
+//@ compile-flags: --force-warn pub_use_of_private_extern_crate
+//@ check-pass
+
+extern crate core;
+pub use core as reexported_core;
+//~^ warning: extern crate `core` is private
+//~| warning: this was previously accepted by the compiler
+
+fn main() {}
diff --git a/tests/ui/lint/force-warn/ice-free.stderr b/tests/ui/lint/force-warn/ice-free.stderr
new file mode 100644
index 00000000000..b64e3b138a2
--- /dev/null
+++ b/tests/ui/lint/force-warn/ice-free.stderr
@@ -0,0 +1,32 @@
+warning[E0365]: extern crate `core` is private and cannot be re-exported
+  --> $DIR/ice-free.rs:5:9
+   |
+LL | pub use core as reexported_core;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = 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 #127909 <https://github.com/rust-lang/rust/issues/127909>
+   = note: requested on the command line with `--force-warn pub-use-of-private-extern-crate`
+help: consider making the `extern crate` item publicly accessible
+   |
+LL | pub extern crate core;
+   | +++
+
+warning: 1 warning emitted
+
+For more information about this error, try `rustc --explain E0365`.
+Future incompatibility report: Future breakage diagnostic:
+warning[E0365]: extern crate `core` is private and cannot be re-exported
+  --> $DIR/ice-free.rs:5:9
+   |
+LL | pub use core as reexported_core;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = 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 #127909 <https://github.com/rust-lang/rust/issues/127909>
+   = note: requested on the command line with `--force-warn pub-use-of-private-extern-crate`
+help: consider making the `extern crate` item publicly accessible
+   |
+LL | pub extern crate core;
+   | +++
+
diff --git a/tests/ui/lint/implicit_autorefs.fixed b/tests/ui/lint/implicit_autorefs.fixed
index 454dfe76372..7aa21e77458 100644
--- a/tests/ui/lint/implicit_autorefs.fixed
+++ b/tests/ui/lint/implicit_autorefs.fixed
@@ -1,4 +1,4 @@
-//@ check-pass
+//@ check-fail
 //@ run-rustfix
 
 #![allow(dead_code)] // For the rustfix-ed code.
@@ -8,7 +8,7 @@ use std::ops::Deref;
 
 unsafe fn test_const(ptr: *const [u8]) {
     let _ = (&(*ptr))[..16];
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 struct Test {
@@ -17,36 +17,36 @@ struct Test {
 
 unsafe fn test_field(ptr: *const Test) -> *const [u8] {
     let l = (&(*ptr).field).len();
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 
     &raw const (&(*ptr).field)[..l - 1]
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_builtin_index(a: *mut [String]) {
     _ = (&(*a)[0]).len();
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 
     _ = (&(&(*a))[..1][0]).len();
-    //~^ WARN implicit autoref
-    //~^^ WARN implicit autoref
+    //~^ ERROR implicit autoref
+    //~^^ ERROR implicit autoref
 }
 
 unsafe fn test_overloaded_deref_const(ptr: *const ManuallyDrop<Test>) {
     let _ = (&(*ptr)).field;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = &raw const (&(*ptr)).field;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_overloaded_deref_mut(ptr: *mut ManuallyDrop<Test>) {
     let _ = (&(*ptr)).field;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_double_overloaded_deref_const(ptr: *const ManuallyDrop<ManuallyDrop<Test>>) {
     let _ = (&(*ptr)).field;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_manually_overloaded_deref() {
@@ -54,52 +54,55 @@ unsafe fn test_manually_overloaded_deref() {
 
     impl<T> Deref for W<T> {
         type Target = T;
-        fn deref(&self) -> &T { &self.0 }
+        fn deref(&self) -> &T {
+            &self.0
+        }
     }
 
     let w: W<i32> = W(5);
     let w = &raw const w;
     let _p: *const i32 = &raw const *(&**w);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 struct Test2 {
     // Derefs to `[u8]`.
-    field: &'static [u8]
+    field: &'static [u8],
 }
 
 fn test_more_manual_deref(ptr: *const Test2) -> usize {
     unsafe { (&(*ptr).field).len() }
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_no_attr(ptr: *mut ManuallyDrop<u8>) {
-    ptr.write(ManuallyDrop::new(1)); // Should not warn, as `ManuallyDrop::write` is not
-                                     // annotated with `#[rustc_no_implicit_auto_ref]`
+    // Should not warn, as `ManuallyDrop::write` is not
+    // annotated with `#[rustc_no_implicit_auto_ref]`
+    ptr.write(ManuallyDrop::new(1));
 }
 
 unsafe fn test_vec_get(ptr: *mut Vec<u8>) {
     let _ = (&(*ptr)).get(0);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = (&(*ptr)).get_unchecked(0);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = (&mut (*ptr)).get_mut(0);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = (&mut (*ptr)).get_unchecked_mut(0);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_string(ptr: *mut String) {
     let _ = (&(*ptr)).len();
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = (&(*ptr)).is_empty();
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn slice_ptr_len_because_of_msrv<T>(slice: *const [T]) {
     let _ = (&(&(*slice))[..]).len();
-    //~^ WARN implicit autoref
-    //~^^ WARN implicit autoref
+    //~^ ERROR implicit autoref
+    //~^^ ERROR implicit autoref
 }
 
 fn main() {}
diff --git a/tests/ui/lint/implicit_autorefs.rs b/tests/ui/lint/implicit_autorefs.rs
index 507d6536828..f33cb08e985 100644
--- a/tests/ui/lint/implicit_autorefs.rs
+++ b/tests/ui/lint/implicit_autorefs.rs
@@ -1,4 +1,4 @@
-//@ check-pass
+//@ check-fail
 //@ run-rustfix
 
 #![allow(dead_code)] // For the rustfix-ed code.
@@ -8,7 +8,7 @@ use std::ops::Deref;
 
 unsafe fn test_const(ptr: *const [u8]) {
     let _ = (*ptr)[..16];
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 struct Test {
@@ -17,36 +17,36 @@ struct Test {
 
 unsafe fn test_field(ptr: *const Test) -> *const [u8] {
     let l = (*ptr).field.len();
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 
     &raw const (*ptr).field[..l - 1]
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_builtin_index(a: *mut [String]) {
     _ = (*a)[0].len();
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 
     _ = (*a)[..1][0].len();
-    //~^ WARN implicit autoref
-    //~^^ WARN implicit autoref
+    //~^ ERROR implicit autoref
+    //~^^ ERROR implicit autoref
 }
 
 unsafe fn test_overloaded_deref_const(ptr: *const ManuallyDrop<Test>) {
     let _ = (*ptr).field;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = &raw const (*ptr).field;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_overloaded_deref_mut(ptr: *mut ManuallyDrop<Test>) {
     let _ = (*ptr).field;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_double_overloaded_deref_const(ptr: *const ManuallyDrop<ManuallyDrop<Test>>) {
     let _ = (*ptr).field;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_manually_overloaded_deref() {
@@ -54,52 +54,55 @@ unsafe fn test_manually_overloaded_deref() {
 
     impl<T> Deref for W<T> {
         type Target = T;
-        fn deref(&self) -> &T { &self.0 }
+        fn deref(&self) -> &T {
+            &self.0
+        }
     }
 
     let w: W<i32> = W(5);
     let w = &raw const w;
     let _p: *const i32 = &raw const **w;
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 struct Test2 {
     // Derefs to `[u8]`.
-    field: &'static [u8]
+    field: &'static [u8],
 }
 
 fn test_more_manual_deref(ptr: *const Test2) -> usize {
     unsafe { (*ptr).field.len() }
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_no_attr(ptr: *mut ManuallyDrop<u8>) {
-    ptr.write(ManuallyDrop::new(1)); // Should not warn, as `ManuallyDrop::write` is not
-                                     // annotated with `#[rustc_no_implicit_auto_ref]`
+    // Should not warn, as `ManuallyDrop::write` is not
+    // annotated with `#[rustc_no_implicit_auto_ref]`
+    ptr.write(ManuallyDrop::new(1));
 }
 
 unsafe fn test_vec_get(ptr: *mut Vec<u8>) {
     let _ = (*ptr).get(0);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = (*ptr).get_unchecked(0);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = (*ptr).get_mut(0);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = (*ptr).get_unchecked_mut(0);
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn test_string(ptr: *mut String) {
     let _ = (*ptr).len();
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
     let _ = (*ptr).is_empty();
-    //~^ WARN implicit autoref
+    //~^ ERROR implicit autoref
 }
 
 unsafe fn slice_ptr_len_because_of_msrv<T>(slice: *const [T]) {
     let _ = (*slice)[..].len();
-    //~^ WARN implicit autoref
-    //~^^ WARN implicit autoref
+    //~^ ERROR implicit autoref
+    //~^^ ERROR implicit autoref
 }
 
 fn main() {}
diff --git a/tests/ui/lint/implicit_autorefs.stderr b/tests/ui/lint/implicit_autorefs.stderr
index 80ba8ae2fd2..bd914e2998a 100644
--- a/tests/ui/lint/implicit_autorefs.stderr
+++ b/tests/ui/lint/implicit_autorefs.stderr
@@ -1,4 +1,4 @@
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:10:13
    |
 LL |     let _ = (*ptr)[..16];
@@ -12,13 +12,13 @@ note: autoref is being applied to this expression, resulting in: `&[u8]`
    |
 LL |     let _ = (*ptr)[..16];
    |             ^^^^^^
-   = note: `#[warn(dangerous_implicit_autorefs)]` on by default
+   = note: `#[deny(dangerous_implicit_autorefs)]` on by default
 help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
    |
 LL |     let _ = (&(*ptr))[..16];
    |             ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:19:13
    |
 LL |     let l = (*ptr).field.len();
@@ -39,7 +39,7 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let l = (&(*ptr).field).len();
    |             ++            +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:22:16
    |
 LL |     &raw const (*ptr).field[..l - 1]
@@ -58,7 +58,7 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     &raw const (&(*ptr).field)[..l - 1]
    |                ++            +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:27:9
    |
 LL |     _ = (*a)[0].len();
@@ -79,7 +79,7 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     _ = (&(*a)[0]).len();
    |         ++       +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:30:9
    |
 LL |     _ = (*a)[..1][0].len();
@@ -100,7 +100,7 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     _ = (&(*a)[..1][0]).len();
    |         ++            +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:30:9
    |
 LL |     _ = (*a)[..1][0].len();
@@ -119,7 +119,7 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     _ = (&(*a))[..1][0].len();
    |         ++    +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:36:13
    |
 LL |     let _ = (*ptr).field;
@@ -134,7 +134,7 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*ptr)).field;
    |             ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:38:24
    |
 LL |     let _ = &raw const (*ptr).field;
@@ -149,7 +149,7 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = &raw const (&(*ptr)).field;
    |                        ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:43:13
    |
 LL |     let _ = (*ptr).field;
@@ -164,7 +164,7 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*ptr)).field;
    |             ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
+error: implicit autoref creates a reference to the dereference of a raw pointer
   --> $DIR/implicit_autorefs.rs:48:13
    |
 LL |     let _ = (*ptr).field;
@@ -179,8 +179,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*ptr)).field;
    |             ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:62:26
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:64:26
    |
 LL |     let _p: *const i32 = &raw const **w;
    |                          ^^^^^^^^^^^^^-
@@ -189,7 +189,7 @@ LL |     let _p: *const i32 = &raw const **w;
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&W<i32>`
-  --> $DIR/implicit_autorefs.rs:62:38
+  --> $DIR/implicit_autorefs.rs:64:38
    |
 LL |     let _p: *const i32 = &raw const **w;
    |                                      ^^
@@ -198,8 +198,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _p: *const i32 = &raw const *(&**w);
    |                                      +++  +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:72:14
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:74:14
    |
 LL |     unsafe { (*ptr).field.len() }
    |              ^^---^^^^^^^^^^^^^
@@ -208,7 +208,7 @@ LL |     unsafe { (*ptr).field.len() }
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&[u8]`
-  --> $DIR/implicit_autorefs.rs:72:14
+  --> $DIR/implicit_autorefs.rs:74:14
    |
 LL |     unsafe { (*ptr).field.len() }
    |              ^^^^^^^^^^^^
@@ -219,8 +219,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     unsafe { (&(*ptr).field).len() }
    |              ++            +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:82:13
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:85:13
    |
 LL |     let _ = (*ptr).get(0);
    |             ^^---^^^^^^^^
@@ -229,7 +229,7 @@ LL |     let _ = (*ptr).get(0);
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&[u8]`
-  --> $DIR/implicit_autorefs.rs:82:13
+  --> $DIR/implicit_autorefs.rs:85:13
    |
 LL |     let _ = (*ptr).get(0);
    |             ^^^^^^
@@ -240,8 +240,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*ptr)).get(0);
    |             ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:84:13
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:87:13
    |
 LL |     let _ = (*ptr).get_unchecked(0);
    |             ^^---^^^^^^^^^^^^^^^^^^
@@ -250,7 +250,7 @@ LL |     let _ = (*ptr).get_unchecked(0);
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&[u8]`
-  --> $DIR/implicit_autorefs.rs:84:13
+  --> $DIR/implicit_autorefs.rs:87:13
    |
 LL |     let _ = (*ptr).get_unchecked(0);
    |             ^^^^^^
@@ -261,8 +261,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*ptr)).get_unchecked(0);
    |             ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:86:13
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:89:13
    |
 LL |     let _ = (*ptr).get_mut(0);
    |             ^^---^^^^^^^^^^^^
@@ -271,7 +271,7 @@ LL |     let _ = (*ptr).get_mut(0);
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&mut [u8]`
-  --> $DIR/implicit_autorefs.rs:86:13
+  --> $DIR/implicit_autorefs.rs:89:13
    |
 LL |     let _ = (*ptr).get_mut(0);
    |             ^^^^^^
@@ -282,8 +282,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&mut (*ptr)).get_mut(0);
    |             +++++       +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:88:13
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:91:13
    |
 LL |     let _ = (*ptr).get_unchecked_mut(0);
    |             ^^---^^^^^^^^^^^^^^^^^^^^^^
@@ -292,7 +292,7 @@ LL |     let _ = (*ptr).get_unchecked_mut(0);
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&mut [u8]`
-  --> $DIR/implicit_autorefs.rs:88:13
+  --> $DIR/implicit_autorefs.rs:91:13
    |
 LL |     let _ = (*ptr).get_unchecked_mut(0);
    |             ^^^^^^
@@ -303,8 +303,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&mut (*ptr)).get_unchecked_mut(0);
    |             +++++       +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:93:13
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:96:13
    |
 LL |     let _ = (*ptr).len();
    |             ^^---^^^^^^^
@@ -313,7 +313,7 @@ LL |     let _ = (*ptr).len();
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&String`
-  --> $DIR/implicit_autorefs.rs:93:13
+  --> $DIR/implicit_autorefs.rs:96:13
    |
 LL |     let _ = (*ptr).len();
    |             ^^^^^^
@@ -324,8 +324,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*ptr)).len();
    |             ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:95:13
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:98:13
    |
 LL |     let _ = (*ptr).is_empty();
    |             ^^---^^^^^^^^^^^^
@@ -334,7 +334,7 @@ LL |     let _ = (*ptr).is_empty();
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&String`
-  --> $DIR/implicit_autorefs.rs:95:13
+  --> $DIR/implicit_autorefs.rs:98:13
    |
 LL |     let _ = (*ptr).is_empty();
    |             ^^^^^^
@@ -345,8 +345,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*ptr)).is_empty();
    |             ++      +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:100:13
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:103:13
    |
 LL |     let _ = (*slice)[..].len();
    |             ^^-----^^^^^^^^^^^
@@ -355,7 +355,7 @@ LL |     let _ = (*slice)[..].len();
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&[T]`
-  --> $DIR/implicit_autorefs.rs:100:13
+  --> $DIR/implicit_autorefs.rs:103:13
    |
 LL |     let _ = (*slice)[..].len();
    |             ^^^^^^^^^^^^
@@ -366,8 +366,8 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*slice)[..]).len();
    |             ++            +
 
-warning: implicit autoref creates a reference to the dereference of a raw pointer
-  --> $DIR/implicit_autorefs.rs:100:13
+error: implicit autoref creates a reference to the dereference of a raw pointer
+  --> $DIR/implicit_autorefs.rs:103:13
    |
 LL |     let _ = (*slice)[..].len();
    |             ^^-----^^^^^
@@ -376,7 +376,7 @@ LL |     let _ = (*slice)[..].len();
    |
    = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
 note: autoref is being applied to this expression, resulting in: `&[T]`
-  --> $DIR/implicit_autorefs.rs:100:13
+  --> $DIR/implicit_autorefs.rs:103:13
    |
 LL |     let _ = (*slice)[..].len();
    |             ^^^^^^^^
@@ -385,5 +385,5 @@ help: try using a raw pointer method instead; or if this reference is intentiona
 LL |     let _ = (&(*slice))[..].len();
    |             ++        +
 
-warning: 20 warnings emitted
+error: aborting due to 20 previous errors
 
diff --git a/tests/ui/lint/unused/useless-comment.rs b/tests/ui/lint/unused/useless-comment.rs
index 4ec52f20747..898665278e3 100644
--- a/tests/ui/lint/unused/useless-comment.rs
+++ b/tests/ui/lint/unused/useless-comment.rs
@@ -9,8 +9,13 @@ macro_rules! mac {
 /// foo //~ ERROR unused doc comment
 mac!();
 
+/// a //~ ERROR unused doc comment
+#[doc(test(attr(allow(dead_code))))] //~ ERROR unused doc comment
+unsafe extern "C" { }
+
 fn foo() {
     /// a //~ ERROR unused doc comment
+    #[doc(test(attr(allow(dead_code))))] //~ ERROR unused doc comment
     let x = 12;
 
     /// multi-line //~ ERROR unused doc comment
@@ -19,6 +24,7 @@ fn foo() {
     match x {
         /// c //~ ERROR unused doc comment
         1 => {},
+        #[doc(test(attr(allow(dead_code))))] //~ ERROR unused doc comment
         _ => {}
     }
 
@@ -32,6 +38,7 @@ fn foo() {
     /// bar //~ ERROR unused doc comment
     mac!();
 
+    #[doc(test(attr(allow(dead_code))))] //~ ERROR unused doc comment
     let x = /** comment */ 47; //~ ERROR unused doc comment
 
     /// dox //~ ERROR unused doc comment
diff --git a/tests/ui/lint/unused/useless-comment.stderr b/tests/ui/lint/unused/useless-comment.stderr
index 8bb5bdaeb25..39873b82b75 100644
--- a/tests/ui/lint/unused/useless-comment.stderr
+++ b/tests/ui/lint/unused/useless-comment.stderr
@@ -12,7 +12,28 @@ LL | #![deny(unused_doc_comments)]
    |         ^^^^^^^^^^^^^^^^^^^
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:32:5
+  --> $DIR/useless-comment.rs:12:1
+   |
+LL | /// a
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[doc(test(attr(allow(dead_code))))]
+LL | unsafe extern "C" { }
+   | --------------------- rustdoc does not generate documentation for extern blocks
+   |
+   = help: use `//` for a plain comment
+
+error: unused doc comment
+  --> $DIR/useless-comment.rs:13:1
+   |
+LL | #[doc(test(attr(allow(dead_code))))]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | unsafe extern "C" { }
+   | --------------------- rustdoc does not generate documentation for extern blocks
+   |
+   = help: use `//` for a plain comment
+
+error: unused doc comment
+  --> $DIR/useless-comment.rs:38:5
    |
 LL |     /// bar
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations
@@ -20,17 +41,28 @@ LL |     /// bar
    = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:13:5
+  --> $DIR/useless-comment.rs:17:5
    |
 LL |     /// a
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     #[doc(test(attr(allow(dead_code))))]
 LL |     let x = 12;
    |     ----------- rustdoc does not generate documentation for statements
    |
    = help: use `//` for a plain comment
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:16:5
+  --> $DIR/useless-comment.rs:18:5
+   |
+LL |     #[doc(test(attr(allow(dead_code))))]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     let x = 12;
+   |     ----------- rustdoc does not generate documentation for statements
+   |
+   = help: use `//` for a plain comment
+
+error: unused doc comment
+  --> $DIR/useless-comment.rs:21:5
    |
 LL | /     /// multi-line
 LL | |     /// doc comment
@@ -39,6 +71,7 @@ LL | |     /// that is unused
 LL | /     match x {
 LL | |         /// c
 LL | |         1 => {},
+LL | |         #[doc(test(attr(allow(dead_code))))]
 LL | |         _ => {}
 LL | |     }
    | |_____- rustdoc does not generate documentation for expressions
@@ -46,7 +79,7 @@ LL | |     }
    = help: use `//` for a plain comment
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:20:9
+  --> $DIR/useless-comment.rs:25:9
    |
 LL |         /// c
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -56,7 +89,17 @@ LL |         1 => {},
    = help: use `//` for a plain comment
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:25:5
+  --> $DIR/useless-comment.rs:27:9
+   |
+LL |         #[doc(test(attr(allow(dead_code))))]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         _ => {}
+   |         ------- rustdoc does not generate documentation for match arms
+   |
+   = help: use `//` for a plain comment
+
+error: unused doc comment
+  --> $DIR/useless-comment.rs:31:5
    |
 LL |     /// foo
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -66,7 +109,7 @@ LL |     unsafe {}
    = help: use `//` for a plain comment
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:28:5
+  --> $DIR/useless-comment.rs:34:5
    |
 LL |     #[doc = "foo"]
    |     ^^^^^^^^^^^^^^
@@ -77,7 +120,7 @@ LL |     3;
    = help: use `//` for a plain comment
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:29:5
+  --> $DIR/useless-comment.rs:35:5
    |
 LL |     #[doc = "bar"]
    |     ^^^^^^^^^^^^^^
@@ -87,7 +130,17 @@ LL |     3;
    = help: use `//` for a plain comment
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:35:13
+  --> $DIR/useless-comment.rs:41:5
+   |
+LL |     #[doc(test(attr(allow(dead_code))))]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     let x = /** comment */ 47;
+   |     -------------------------- rustdoc does not generate documentation for statements
+   |
+   = help: use `//` for a plain comment
+
+error: unused doc comment
+  --> $DIR/useless-comment.rs:42:13
    |
 LL |     let x = /** comment */ 47;
    |             ^^^^^^^^^^^^^^ -- rustdoc does not generate documentation for expressions
@@ -95,7 +148,7 @@ LL |     let x = /** comment */ 47;
    = help: use `/* */` for a plain comment
 
 error: unused doc comment
-  --> $DIR/useless-comment.rs:37:5
+  --> $DIR/useless-comment.rs:44:5
    |
 LL |       /// dox
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -106,5 +159,5 @@ LL | |     }
    |
    = help: use `//` for a plain comment
 
-error: aborting due to 10 previous errors
+error: aborting due to 15 previous errors
 
diff --git a/tests/ui/rustdoc/doc-test-attr-pass.rs b/tests/ui/rustdoc/doc-test-attr-pass.rs
index f0120b7c2d0..60d1e3722bd 100644
--- a/tests/ui/rustdoc/doc-test-attr-pass.rs
+++ b/tests/ui/rustdoc/doc-test-attr-pass.rs
@@ -6,4 +6,46 @@
 #![doc(test(attr(deny(warnings))))]
 #![doc(test())]
 
+mod test {
+    #![doc(test(attr(allow(warnings))))]
+}
+
+#[doc(test(attr(allow(dead_code))))]
+static S: u32 = 5;
+
+#[doc(test(attr(allow(dead_code))))]
+const C: u32 = 5;
+
+#[doc(test(attr(deny(dead_code))))]
+struct A {
+    #[doc(test(attr(allow(dead_code))))]
+    field: u32
+}
+
+#[doc(test(attr(deny(dead_code))))]
+union U {
+    #[doc(test(attr(allow(dead_code))))]
+    field: u32,
+    field2: u64,
+}
+
+#[doc(test(attr(deny(dead_code))))]
+enum Enum {
+    #[doc(test(attr(allow(dead_code))))]
+    Variant1,
+}
+
+#[doc(test(attr(deny(dead_code))))]
+impl A {
+    #[doc(test(attr(deny(dead_code))))]
+    fn method() {}
+}
+
+#[doc(test(attr(deny(dead_code))))]
+trait MyTrait {
+    #[doc(test(attr(deny(dead_code))))]
+    fn my_trait_fn();
+}
+
+#[doc(test(attr(deny(dead_code))))]
 pub fn foo() {}
diff --git a/tests/crashes/140571.rs b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs
index 97fa1d8432d..f4cde1d62b2 100644
--- a/tests/crashes/140571.rs
+++ b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs
@@ -1,14 +1,21 @@
-//@ known-bug: #140571
+// Regression test for #140571. The compiler used to ICE
+
+#![feature(associated_const_equality, specialization)]
+//~^ WARN the feature `specialization` is incomplete
+
 pub trait IsVoid {
     const IS_VOID: bool;
 }
 impl<T> IsVoid for T {
     default const IS_VOID: bool = false;
 }
-impl<T> Maybe<T> for () where T: NotVoid + ?Sized {}
 
 pub trait NotVoid {}
 impl<T> NotVoid for T where T: IsVoid<IS_VOID = false> + ?Sized {}
 
 pub trait Maybe<T> {}
 impl<T> Maybe<T> for T {}
+impl<T> Maybe<T> for () where T: NotVoid + ?Sized {}
+//~^ ERROR conflicting implementations of trait `Maybe<()>` for type `()`
+
+fn main() {}
diff --git a/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr
new file mode 100644
index 00000000000..a26b30fbb63
--- /dev/null
+++ b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr
@@ -0,0 +1,21 @@
+warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/overlap-due-to-unsatisfied-const-bound.rs:3:39
+   |
+LL | #![feature(associated_const_equality, specialization)]
+   |                                       ^^^^^^^^^^^^^^
+   |
+   = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
+   = help: consider using `min_specialization` instead, which is more stable and complete
+   = note: `#[warn(incomplete_features)]` on by default
+
+error[E0119]: conflicting implementations of trait `Maybe<()>` for type `()`
+  --> $DIR/overlap-due-to-unsatisfied-const-bound.rs:18:1
+   |
+LL | impl<T> Maybe<T> for T {}
+   | ---------------------- first implementation here
+LL | impl<T> Maybe<T> for () where T: NotVoid + ?Sized {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0119`.