Skip to content

Use fewer delayed bugs. #121071

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Use fewer delayed bugs. #121071

merged 1 commit into from
Feb 14, 2024

Conversation

nnethercote
Copy link
Contributor

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

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 14, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in const_evaluatable.rs

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()),
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// resolution errors here; delay ICE in favor of those errors.
// resolution errors here; ICE no errors have been emitted yet.

Copy link
Contributor Author

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!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems kinda redundant...

Copy link
Contributor Author

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.

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.
@nnethercote
Copy link
Contributor Author

I addressed the comments.

@oli-obk
Copy link
Contributor

oli-obk commented Feb 14, 2024

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Feb 14, 2024

📌 Commit 05849e8 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 14, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2024
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
@bors bors merged commit 638f525 into rust-lang:master Feb 14, 2024
@rustbot rustbot added this to the 1.78.0 milestone Feb 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2024
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`
@nnethercote nnethercote deleted the fewer-delayed-bugs branch February 14, 2024 19:44
nnethercote added a commit to nnethercote/rust that referenced this pull request Feb 14, 2024
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.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 15, 2024
…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.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2024
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 free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants