@@ -522,6 +522,11 @@ impl Drop for HandlerInner {
522522 "no warnings or errors encountered even though `delayed_good_path_bugs` issued" ,
523523 ) ;
524524 }
525+
526+ assert ! (
527+ self . unstable_expect_diagnostics. is_empty( ) ,
528+ "all diagnostics with unstable expectations should have been converted" ,
529+ ) ;
525530 }
526531}
527532
@@ -942,25 +947,25 @@ impl Handler {
942947
943948 let mut inner = self . inner . borrow_mut ( ) ;
944949 for mut diag in diags. into_iter ( ) {
945- let mut unstable_id = diag
950+ diag. update_unstable_expectation_id ( unstable_to_stable) ;
951+
952+ let stable_id = diag
946953 . level
947954 . get_expectation_id ( )
948955 . expect ( "all diagnostics inside `unstable_expect_diagnostics` must have a `LintExpectationId`" ) ;
949-
950- // The unstable to stable map only maps the unstable `AttrId` to a stable `HirId` with an attribute index.
951- // The lint index inside the attribute is manually transferred here.
952- let lint_index = unstable_id. get_lint_index ( ) ;
953- unstable_id. set_lint_index ( None ) ;
954- let mut stable_id = * unstable_to_stable
955- . get ( & unstable_id)
956- . expect ( "each unstable `LintExpectationId` must have a matching stable id" ) ;
957-
958- stable_id. set_lint_index ( lint_index) ;
959- diag. level = Level :: Expect ( stable_id) ;
960956 inner. fulfilled_expectations . insert ( stable_id) ;
961957
962958 ( * TRACK_DIAGNOSTICS ) ( & diag) ;
963959 }
960+
961+ inner
962+ . stashed_diagnostics
963+ . values_mut ( )
964+ . for_each ( |diag| diag. update_unstable_expectation_id ( unstable_to_stable) ) ;
965+ inner
966+ . future_breakage_diagnostics
967+ . iter_mut ( )
968+ . for_each ( |diag| diag. update_unstable_expectation_id ( unstable_to_stable) ) ;
964969 }
965970
966971 /// This methods steals all [`LintExpectationId`]s that are stored inside
0 commit comments