Skip to content

Commit 3c860e3

Browse files
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 #142144
2 parents 5f6d982 + 5bab0d2 commit 3c860e3

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ impl DiagCtxtInner {
15291529
// Future breakages aren't emitted if they're `Level::Allow` or
15301530
// `Level::Expect`, but they still need to be constructed and
15311531
// stashed below, so they'll trigger the must_produce_diag check.
1532-
assert_matches!(diagnostic.level, Error | Warning | Allow | Expect);
1532+
assert_matches!(diagnostic.level, Error | ForceWarning | Warning | Allow | Expect);
15331533
self.future_breakage_diagnostics.push(diagnostic.clone());
15341534
}
15351535

tests/ui/lint/force-warn/ice-free.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ compile-flags: --force-warn pub_use_of_private_extern_crate
2+
//@ check-pass
3+
4+
extern crate core;
5+
pub use core as reexported_core;
6+
//~^ warning: extern crate `core` is private
7+
//~| warning: this was previously accepted by the compiler
8+
9+
fn main() {}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
warning[E0365]: extern crate `core` is private and cannot be re-exported
2+
--> $DIR/ice-free.rs:5:9
3+
|
4+
LL | pub use core as reexported_core;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8+
= note: for more information, see issue #127909 <https://github.com/rust-lang/rust/issues/127909>
9+
= note: requested on the command line with `--force-warn pub-use-of-private-extern-crate`
10+
help: consider making the `extern crate` item publicly accessible
11+
|
12+
LL | pub extern crate core;
13+
| +++
14+
15+
warning: 1 warning emitted
16+
17+
For more information about this error, try `rustc --explain E0365`.
18+
Future incompatibility report: Future breakage diagnostic:
19+
warning[E0365]: extern crate `core` is private and cannot be re-exported
20+
--> $DIR/ice-free.rs:5:9
21+
|
22+
LL | pub use core as reexported_core;
23+
| ^^^^^^^^^^^^^^^^^^^^^^^
24+
|
25+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
26+
= note: for more information, see issue #127909 <https://github.com/rust-lang/rust/issues/127909>
27+
= note: requested on the command line with `--force-warn pub-use-of-private-extern-crate`
28+
help: consider making the `extern crate` item publicly accessible
29+
|
30+
LL | pub extern crate core;
31+
| +++
32+

0 commit comments

Comments
 (0)