@@ -1437,6 +1437,24 @@ impl DiagCtxtInner {
1437
1437
1438
1438
// Return value is only `Some` if the level is `Error` or `DelayedBug`.
1439
1439
fn emit_diagnostic ( & mut self , mut diagnostic : DiagInner ) -> Option < ErrorGuaranteed > {
1440
+ match diagnostic. level {
1441
+ Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) => {
1442
+ // The `LintExpectationId` can be stable or unstable depending on when it was
1443
+ // created. Diagnostics created before the definition of `HirId`s are unstable and
1444
+ // can not yet be stored. Instead, they are buffered until the `LintExpectationId`
1445
+ // is replaced by a stable one by the `LintLevelsBuilder`.
1446
+ if let LintExpectationId :: Unstable { .. } = expect_id {
1447
+ // We don't call TRACK_DIAGNOSTIC because we wait for the
1448
+ // unstable ID to be updated, whereupon the diagnostic will be
1449
+ // passed into this method again.
1450
+ self . unstable_expect_diagnostics . push ( diagnostic) ;
1451
+ return None ;
1452
+ }
1453
+ // Continue through to the `Expect`/`ForceWarning` case below.
1454
+ }
1455
+ _ => { }
1456
+ }
1457
+
1440
1458
if diagnostic. has_future_breakage ( ) {
1441
1459
// Future breakages aren't emitted if they're `Level::Allow`,
1442
1460
// but they still need to be constructed and stashed below,
@@ -1512,16 +1530,8 @@ impl DiagCtxtInner {
1512
1530
return None ;
1513
1531
}
1514
1532
Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) => {
1515
- // Diagnostics created before the definition of `HirId`s are
1516
- // unstable and can not yet be stored. Instead, they are
1517
- // buffered until the `LintExpectationId` is replaced by a
1518
- // stable one by the `LintLevelsBuilder`.
1519
1533
if let LintExpectationId :: Unstable { .. } = expect_id {
1520
- // We don't call TRACK_DIAGNOSTIC because we wait for the
1521
- // unstable ID to be updated, whereupon the diagnostic will
1522
- // be passed into this method again.
1523
- self . unstable_expect_diagnostics . push ( diagnostic) ;
1524
- return None ;
1534
+ unreachable ! ( ) ; // this case was handled at the top of this function
1525
1535
}
1526
1536
self . fulfilled_expectations . insert ( expect_id. normalize ( ) ) ;
1527
1537
if let Expect ( _) = diagnostic. level {
0 commit comments