about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/json.rs
diff options
context:
space:
mode:
authorxFrednet <xFrednet@gmail.com>2024-06-25 20:05:37 +0200
committerxFrednet <xFrednet@gmail.com>2024-06-25 22:32:46 +0200
commit1d667a0937f6242366d1f47d359a2c739f3c62b1 (patch)
tree4063a27c92e90443b2eb01cf21f95641d260f33b /compiler/rustc_errors/src/json.rs
parentb124b3666e2109d01c8ec02ecae6d2e965e4bbe8 (diff)
downloadrust-1d667a0937f6242366d1f47d359a2c739f3c62b1.tar.gz
rust-1d667a0937f6242366d1f47d359a2c739f3c62b1.zip
Prevent ICE from expected future breakage
Diffstat (limited to 'compiler/rustc_errors/src/json.rs')
-rw-r--r--compiler/rustc_errors/src/json.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs
index af82d8092c2..3d2a04d5851 100644
--- a/compiler/rustc_errors/src/json.rs
+++ b/compiler/rustc_errors/src/json.rs
@@ -135,7 +135,12 @@ impl Emitter for JsonEmitter {
         let data: Vec<FutureBreakageItem<'_>> = diags
             .into_iter()
             .map(|mut diag| {
-                if diag.level == crate::Level::Allow {
+                // The `FutureBreakageItem` is collected and serialized.
+                // However, the `allow` and `expect` lint levels can't usually
+                // be serialized. The lint level is overwritten to allow the
+                // serialization again and force a lint emission.
+                // (This is an educated guess. I didn't originally add this)
+                if matches!(diag.level, crate::Level::Allow | crate::Level::Expect(..)) {
                     diag.level = crate::Level::Warning;
                 }
                 FutureBreakageItem {