Skip to content

Commit 6a48407

Browse files
committed
Remove unnecessary setting of suppressed_expected_diag.
It's currently set in three places. Two of them seem to be unnecessary, and the one in `emit_diagnostic` can be changed to only trigger for `Expect` level diagnostics. After this change the name `suppressed_expected_diag` actually matches the code's behaviour, which is nice.
1 parent 8b25343 commit 6a48407

File tree

1 file changed

+7
-7
lines changed
  • compiler/rustc_errors/src

1 file changed

+7
-7
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,6 @@ impl DiagCtxt {
11791179
inner.check_unstable_expect_diagnostics = true;
11801180

11811181
if !diags.is_empty() {
1182-
inner.suppressed_expected_diag = true;
11831182
for mut diag in diags.into_iter() {
11841183
diag.update_unstable_expectation_id(unstable_to_stable);
11851184

@@ -1291,15 +1290,10 @@ impl DiagCtxtInner {
12911290
}
12921291

12931292
if diagnostic.has_future_breakage() {
1294-
// Future breakages aren't emitted if they're Level::Allow,
1295-
// but they still need to be constructed and stashed below,
1296-
// so they'll trigger the good-path bug check.
1297-
self.suppressed_expected_diag = true;
12981293
self.future_breakage_diagnostics.push(diagnostic.clone());
12991294
}
13001295

13011296
if let Some(expectation_id) = diagnostic.level.get_expectation_id() {
1302-
self.suppressed_expected_diag = true;
13031297
self.fulfilled_expectations.insert(expectation_id.normalize());
13041298
}
13051299

@@ -1310,7 +1304,13 @@ impl DiagCtxtInner {
13101304
return None;
13111305
}
13121306

1313-
if matches!(diagnostic.level, Expect(_) | Allow) {
1307+
if matches!(diagnostic.level, Expect(_)) {
1308+
self.suppressed_expected_diag = true;
1309+
(*TRACK_DIAGNOSTIC)(diagnostic, &mut |_| {});
1310+
return None;
1311+
}
1312+
1313+
if matches!(diagnostic.level, Allow) {
13141314
(*TRACK_DIAGNOSTIC)(diagnostic, &mut |_| {});
13151315
return None;
13161316
}

0 commit comments

Comments
 (0)