about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-06-07 22:22:59 +0200
committerGitHub <noreply@github.com>2025-06-07 22:22:59 +0200
commit3c860e37646af30eb331493e3e4c612260d6abc8 (patch)
tree17c487261f8edb56853d1a8cffd0b01c5934463e /tests
parent5f6d9829cdf1bacd97d757f8aa5357718586a05e (diff)
parent5bab0d2e66f77e34865026856dcd5ae21f0b2d2f (diff)
downloadrust-3c860e37646af30eb331493e3e4c612260d6abc8.tar.gz
rust-3c860e37646af30eb331493e3e4c612260d6abc8.zip
Rollup merge of #142148 - workingjubilee:dont-ice-on-force-warn, r=Urgau
compiler: Treat ForceWarning as a Warning for diagnostic level

This silences an ICE.

No idea if this is the correct solution though tbh.

Fixes rust-lang/rust#142144
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/force-warn/ice-free.rs9
-rw-r--r--tests/ui/lint/force-warn/ice-free.stderr32
2 files changed, 41 insertions, 0 deletions
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;
+   | +++
+