@@ -502,14 +502,14 @@ struct DiagCtxtInner {
502
502
/// marked as fulfilled. This is a collection of all [`LintExpectationId`]s
503
503
/// that have been marked as fulfilled this way.
504
504
///
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
+ ///
505
510
/// [RFC-2383]: https://rust-lang.github.io/rfcs/2383-lint-reasons.html
506
511
fulfilled_expectations : FxIndexSet < LintExpectationId > ,
507
512
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
-
513
513
/// The file where the ICE information is stored. This allows delayed_span_bug backtraces to be
514
514
/// stored along side the main panic backtrace.
515
515
ice_file : Option < PathBuf > ,
@@ -724,7 +724,6 @@ impl DiagCtxt {
724
724
stashed_diagnostics,
725
725
future_breakage_diagnostics,
726
726
fulfilled_expectations,
727
- stolen_fulfilled_expectations : _,
728
727
ice_file : _,
729
728
} = inner. deref_mut ( ) ;
730
729
@@ -1078,7 +1077,6 @@ impl<'a> DiagCtxtHandle<'a> {
1078
1077
/// [`DiagCtxtInner`] and indicate that the linked expectation has been fulfilled.
1079
1078
#[ must_use]
1080
1079
pub fn steal_fulfilled_expectation_ids ( & self ) -> FxIndexSet < LintExpectationId > {
1081
- self . inner . borrow_mut ( ) . stolen_fulfilled_expectations = true ;
1082
1080
std:: mem:: take ( & mut self . inner . borrow_mut ( ) . fulfilled_expectations )
1083
1081
}
1084
1082
@@ -1388,7 +1386,6 @@ impl DiagCtxtInner {
1388
1386
stashed_diagnostics : Default :: default ( ) ,
1389
1387
future_breakage_diagnostics : Vec :: new ( ) ,
1390
1388
fulfilled_expectations : Default :: default ( ) ,
1391
- stolen_fulfilled_expectations : false ,
1392
1389
ice_file : None ,
1393
1390
}
1394
1391
}
@@ -1492,10 +1489,6 @@ impl DiagCtxtInner {
1492
1489
return None ;
1493
1490
}
1494
1491
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
- ) ;
1499
1492
self . fulfilled_expectations . insert ( expect_id) ;
1500
1493
if let Expect ( _) = diagnostic. level {
1501
1494
// Nothing emitted here for expected lints.
0 commit comments