diff options
| author | bors <bors@rust-lang.org> | 2022-06-10 09:05:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-10 09:05:50 +0000 |
| commit | f19ccc2e8dab09e542d4c5a3ec14c7d5bce8d50e (patch) | |
| tree | 4bb9736aa9f8bbc35b256aafcbf7c07e1c2402f3 /compiler/rustc_errors | |
| parent | 3dea0033f7f40fc3a96b728cb2095da91135f0a4 (diff) | |
| parent | 9d25bc37446529038255f92c2c461a37d227bb9e (diff) | |
| download | rust-f19ccc2e8dab09e542d4c5a3ec14c7d5bce8d50e.tar.gz rust-f19ccc2e8dab09e542d4c5a3ec14c7d5bce8d50e.zip | |
Auto merge of #97939 - JohnTitor:rollup-79pxupb, r=JohnTitor
Rollup of 6 pull requests Successful merges: - #97718 (Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383)) - #97876 (update docs for `std::future::IntoFuture`) - #97888 (Don't use __gxx_personality_v0 in panic_unwind on emscripten target) - #97922 (Remove redundant calls to reserve in impl Write for VecDeque) - #97927 (Do not introduce bindings for types and consts in HRTB.) - #97937 (Fix a typo in `test/ui/hrtb/hrtb-just-for-static.rs`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 3be6dd5af75..83fe2a2df89 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -400,6 +400,9 @@ struct HandlerInner { emitter: Box<dyn Emitter + sync::Send>, delayed_span_bugs: Vec<Diagnostic>, delayed_good_path_bugs: Vec<DelayedDiagnostic>, + /// This flag indicates that an expected diagnostic was emitted and suppressed. + /// This is used for the `delayed_good_path_bugs` check. + suppressed_expected_diag: bool, /// This set contains the `DiagnosticId` of all emitted diagnostics to avoid /// emitting the same diagnostic with extended help (`--teach`) twice, which @@ -495,7 +498,7 @@ impl Drop for HandlerInner { // instead of "require some error happened". Sadly that isn't ideal, as // lints can be `#[allow]`'d, potentially leading to this triggering. // Also, "good path" should be replaced with a better naming. - if !self.has_any_message() { + if !self.has_any_message() && !self.suppressed_expected_diag { let bugs = std::mem::replace(&mut self.delayed_good_path_bugs, Vec::new()); self.flush_delayed( bugs.into_iter().map(DelayedDiagnostic::decorate), @@ -577,6 +580,7 @@ impl Handler { emitter, delayed_span_bugs: Vec::new(), delayed_good_path_bugs: Vec::new(), + suppressed_expected_diag: false, taught_diagnostics: Default::default(), emitted_diagnostic_codes: Default::default(), emitted_diagnostics: Default::default(), @@ -1000,20 +1004,20 @@ impl Handler { let mut inner = self.inner.borrow_mut(); let diags = std::mem::take(&mut inner.unstable_expect_diagnostics); inner.check_unstable_expect_diagnostics = true; - if diags.is_empty() { - return; - } - for mut diag in diags.into_iter() { - diag.update_unstable_expectation_id(unstable_to_stable); + if !diags.is_empty() { + inner.suppressed_expected_diag = true; + for mut diag in diags.into_iter() { + diag.update_unstable_expectation_id(unstable_to_stable); - let stable_id = diag - .level - .get_expectation_id() - .expect("all diagnostics inside `unstable_expect_diagnostics` must have a `LintExpectationId`"); - inner.fulfilled_expectations.insert(stable_id); + let stable_id = diag + .level + .get_expectation_id() + .expect("all diagnostics inside `unstable_expect_diagnostics` must have a `LintExpectationId`"); + inner.fulfilled_expectations.insert(stable_id); - (*TRACK_DIAGNOSTICS)(&diag); + (*TRACK_DIAGNOSTICS)(&diag); + } } inner @@ -1100,6 +1104,7 @@ impl HandlerInner { (*TRACK_DIAGNOSTICS)(diagnostic); if let Level::Expect(expectation_id) = diagnostic.level { + self.suppressed_expected_diag = true; self.fulfilled_expectations.insert(expectation_id); return None; } else if diagnostic.level == Allow { |
