Use AttrId key for unstable<->stable expectation map.

This commit is contained in:
Camille GILLOT 2024-07-04 06:31:07 +00:00
parent 9649706ead
commit 4928b22fa8
3 changed files with 16 additions and 22 deletions

View file

@ -69,7 +69,7 @@ use rustc_macros::{Decodable, Encodable};
pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker};
use rustc_span::source_map::SourceMap;
pub use rustc_span::ErrorGuaranteed;
use rustc_span::{Loc, Span, DUMMY_SP};
use rustc_span::{AttrId, Loc, Span, DUMMY_SP};
pub use snippet::Style;
// Used by external projects such as `rust-gpu`.
// See https://github.com/rust-lang/rust/pull/115393.
@ -1096,7 +1096,7 @@ impl<'a> DiagCtxtHandle<'a> {
pub fn update_unstable_expectation_id(
&self,
unstable_to_stable: &FxIndexMap<LintExpectationId, LintExpectationId>,
unstable_to_stable: FxIndexMap<AttrId, LintExpectationId>,
) {
let mut inner = self.inner.borrow_mut();
let diags = std::mem::take(&mut inner.unstable_expect_diagnostics);
@ -1105,7 +1105,7 @@ impl<'a> DiagCtxtHandle<'a> {
if !diags.is_empty() {
inner.suppressed_expected_diag = true;
for mut diag in diags.into_iter() {
diag.update_unstable_expectation_id(unstable_to_stable);
diag.update_unstable_expectation_id(&unstable_to_stable);
// Here the diagnostic is given back to `emit_diagnostic` where it was first
// intercepted. Now it should be processed as usual, since the unstable expectation
@ -1117,11 +1117,11 @@ impl<'a> DiagCtxtHandle<'a> {
inner
.stashed_diagnostics
.values_mut()
.for_each(|(diag, _guar)| diag.update_unstable_expectation_id(unstable_to_stable));
.for_each(|(diag, _guar)| diag.update_unstable_expectation_id(&unstable_to_stable));
inner
.future_breakage_diagnostics
.iter_mut()
.for_each(|diag| diag.update_unstable_expectation_id(unstable_to_stable));
.for_each(|diag| diag.update_unstable_expectation_id(&unstable_to_stable));
}
/// This methods steals all [`LintExpectationId`]s that are stored inside