@@ -502,14 +502,14 @@ struct DiagCtxtInner {
502502 /// marked as fulfilled. This is a collection of all [`LintExpectationId`]s
503503 /// that have been marked as fulfilled this way.
504504 ///
505+ /// Emitting expectations after having stolen this field can happen. In particular, an
506+ /// `#[expect(warnings)]` can easily make the `UNFULFILLED_LINT_EXPECTATIONS` lint expect
507+ /// itself. To avoid needless complexity in this corner case, we tolerate failing to track
508+ /// those expectations.
509+ ///
505510 /// [RFC-2383]: https://rust-lang.github.io/rfcs/2383-lint-reasons.html
506511 fulfilled_expectations : FxIndexSet < LintExpectationId > ,
507512
508- /// Whether `fulfilled_expectations` has been stolen. This is used to ICE in case we emit
509- /// an expectation diagnostic after stealing it, which means that expectation would not be
510- /// correctly handled.
511- stolen_fulfilled_expectations : bool ,
512-
513513 /// The file where the ICE information is stored. This allows delayed_span_bug backtraces to be
514514 /// stored along side the main panic backtrace.
515515 ice_file : Option < PathBuf > ,
@@ -724,7 +724,6 @@ impl DiagCtxt {
724724 stashed_diagnostics,
725725 future_breakage_diagnostics,
726726 fulfilled_expectations,
727- stolen_fulfilled_expectations : _,
728727 ice_file : _,
729728 } = inner. deref_mut ( ) ;
730729
@@ -1078,7 +1077,6 @@ impl<'a> DiagCtxtHandle<'a> {
10781077 /// [`DiagCtxtInner`] and indicate that the linked expectation has been fulfilled.
10791078 #[ must_use]
10801079 pub fn steal_fulfilled_expectation_ids ( & self ) -> FxIndexSet < LintExpectationId > {
1081- self . inner . borrow_mut ( ) . stolen_fulfilled_expectations = true ;
10821080 std:: mem:: take ( & mut self . inner . borrow_mut ( ) . fulfilled_expectations )
10831081 }
10841082
@@ -1388,7 +1386,6 @@ impl DiagCtxtInner {
13881386 stashed_diagnostics : Default :: default ( ) ,
13891387 future_breakage_diagnostics : Vec :: new ( ) ,
13901388 fulfilled_expectations : Default :: default ( ) ,
1391- stolen_fulfilled_expectations : false ,
13921389 ice_file : None ,
13931390 }
13941391 }
@@ -1492,10 +1489,6 @@ impl DiagCtxtInner {
14921489 return None ;
14931490 }
14941491 Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) => {
1495- assert ! (
1496- !self . stolen_fulfilled_expectations,
1497- "Attempting to emit an expected diagnostic after `check_expectations`." ,
1498- ) ;
14991492 self . fulfilled_expectations . insert ( expect_id) ;
15001493 if let Expect ( _) = diagnostic. level {
15011494 // Nothing emitted here for expected lints.
0 commit comments