-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use fewer delayed bugs. #121071
Use fewer delayed bugs. #121071
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in cc @BoxyUwU Some changes might have occurred in exhaustiveness checking cc @Nadrieril |
ExprKind::Err => { | ||
hir::ExprKind::Err(self.dcx().span_delayed_bug(e.span, "lowered ExprKind::Err")) | ||
} | ||
ExprKind::Err => hir::ExprKind::Err(self.dcx().has_errors().unwrap()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like what should actually happen is adding a ErrorGuaranteed
tag to ast::ExprKind::Err
? Might be worth a FIXME somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done it for ast::TyKind::Err
in #121072. ast::ExprKind::Err
is harder, due to more unusual cases involving recovery in the parser, so I haven't finished that one yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#120586 impls that, I just need to finish reviewing it 😣
@@ -803,13 +803,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> { | |||
|
|||
// Errors in earlier passes can yield error variables without | |||
// resolution errors here; delay ICE in favor of those errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// resolution errors here; delay ICE in favor of those errors. | |
// resolution errors here; ICE no errors have been emitted yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -138,7 +134,10 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for Search<'tcx> { | |||
bug!("unexpected type during structural-match checking: {:?}", ty); | |||
} | |||
ty::Error(_) => { | |||
self.tcx.dcx().span_delayed_bug(self.span, "ty::Error in structural-match check"); | |||
assert!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems kinda redundant...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True! I will remove the assertion.
004d3f3
to
82abcdf
Compare
For some cases where it's clear that an error has already occurred, e.g.: - there's a comment stating exactly that, or - things like HIR lowering, where we are lowering an error kind The commit also tweaks some comments around delayed bug sites.
82abcdf
to
05849e8
Compare
I addressed the comments. |
@bors r+ rollup |
Rollup of 13 pull requests Successful merges: - rust-lang#116387 (Additional doc links and explanation of `Wake`.) - rust-lang#118738 (Netbsd10 update) - rust-lang#118890 (Clarify the lifetimes of allocations returned by the `Allocator` trait) - rust-lang#120498 (Uplift `TypeVisitableExt` into `rustc_type_ir`) - rust-lang#120530 (Be less confident when `dyn` suggestion is not checked for object safety) - rust-lang#120915 (Fix suggestion span for `?Sized` when param type has default) - rust-lang#121015 (Optimize `delayed_bug` handling.) - rust-lang#121024 (implement `Default` for `AsciiChar`) - rust-lang#121039 (Correctly compute adjustment casts in GVN) - rust-lang#121045 (Fix two UI tests with incorrect directive / invalid revision) - rust-lang#121049 (Do not point at `#[allow(_)]` as the reason for compat lint triggering) - rust-lang#121071 (Use fewer delayed bugs.) - rust-lang#121073 (Fix typos in `OneLock` doc) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#121071 - nnethercote:fewer-delayed-bugs, r=oli-obk Use fewer delayed bugs. For some cases where it's clear that an error has already occurred, e.g.: - there's a comment stating exactly that, or - things like HIR lowering, where we are lowering an error kind The commit also tweaks some comments around delayed bug sites. r? `@oli-obk`
These were changed to `has_errors` assertions in rust-lang#121071 because that seemed reasonable, but evidently not. Fixes rust-lang#121103. Fixes rust-lang#121108.
…li-obk Reinstate some delayed bugs. These were changed to `has_errors` assertions in rust-lang#121071 because that seemed reasonable, but evidently not. Fixes rust-lang#121103. Fixes rust-lang#121108.
Rollup merge of rust-lang#121116 - nnethercote:fix-121103-121108, r=oli-obk Reinstate some delayed bugs. These were changed to `has_errors` assertions in rust-lang#121071 because that seemed reasonable, but evidently not. Fixes rust-lang#121103. Fixes rust-lang#121108.
For some cases where it's clear that an error has already occurred, e.g.:
The commit also tweaks some comments around delayed bug sites.
r? @oli-obk