Skip to content

delay bug when adjusting NeverToAny twice during diagnostic code - #96379

Merged
bors merged 1 commit into
rust-lang:masterfrom
PrestonFrom:issue_96335
Apr 26, 2022
Merged

delay bug when adjusting NeverToAny twice during diagnostic code#96379
bors merged 1 commit into
rust-lang:masterfrom
PrestonFrom:issue_96335

Conversation

@PrestonFrom

@PrestonFromPrestonFrom commented Apr 25, 2022

Copy link
Copy Markdown
Contributor

Addresses Issue 96335 (#96335) by using delay_span_bug instead of an assert and returning an error type from check_expr_meets_expectation_or_error.

Fixes#96335

@rustbotrustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 25, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @compiler-errors (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 25, 2022
Comment on lines 81 to 92

@compiler-errorscompiler-errorsApr 25, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice to return the adjusted type from here instead of ty_error, so it doesn't meddle with the function call argument diagnostic code in check_argument_types:

Suggested change
ifself.typeck_results.borrow().adjustments().contains_key(expr.hir_id){
self.tcx().sess.delay_span_bug(
expr.span,
"expression with never type wound up being adjusted",
);
returnself.tcx().ty_error();
}
ifletSome(adjustments) = self.typeck_results.borrow().adjustments().get(expr.hir_id){
self.tcx().sess.delay_span_bug(
expr.span,
"expression with never type wound up being adjusted",
);
iflet[Adjustment{kind:Adjust::NeverToAny, target }] = &adjustments[..]{
return target;
}else{
returnself.tcx().ty_error();
}
}

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

That's a great idea! Thank you!

@compiler-errors

compiler-errors commented Apr 25, 2022

Copy link
Copy Markdown
Contributor

Can you squash the commit history to get rid of the merge commit and the work-in-progress code that you committed? Usually I just git pull --rebase to avoid merge commits when updating local branches, but I digress..

Also, for posterity, it would be nice to give this PR a name like "delay bug when adjusting NeverToAny twice during diagnostic code". Or whatever you think is a better descriptive title.

@PrestonFrom

Copy link
Copy Markdown
ContributorAuthor

Thank you for the quick review!!

Can you squash the commit history to get rid of the merge commit and the work-in-progress code that you committed? Usually I just git pull --rebase to avoid merge commits when updating local branches, but I digress..

I will certainly be using rebase from now on! I created a bit of a mess squashing, but I think it's correct now.

Also, for posterity, it would be nice to give this PR a name like "delay bug when adjusting NeverToAny twice during diagnostic code". Or whatever you think is a better descriptive title.

I like that suggestion!

@compiler-errorscompiler-errors changed the title Issue 96335delay bug when adjusting NeverToAny twice during diagnostic codeApr 25, 2022
@compiler-errors

Copy link
Copy Markdown
Contributor

Thanks for the contribution. Fixing ICEs is totally rad.

@bors r+

@bors

bors commented Apr 25, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 5165295 has been approved by compiler-errors

@borsbors 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 Apr 25, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 25, 2022
…-errors
delay bug when adjusting `NeverToAny` twice during diagnostic code
Addresses Issue 96335 (rust-lang#96335) by using `delay_span_bug` instead of an assert and returning an error type from `check_expr_meets_expectation_or_error`.
Fixesrust-lang#96335
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 25, 2022
…-errors
delay bug when adjusting `NeverToAny` twice during diagnostic code
Addresses Issue 96335 (rust-lang#96335) by using `delay_span_bug` instead of an assert and returning an error type from `check_expr_meets_expectation_or_error`.
Fixesrust-lang#96335
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 25, 2022
…-errors
delay bug when adjusting `NeverToAny` twice during diagnostic code
Addresses Issue 96335 (rust-lang#96335) by using `delay_span_bug` instead of an assert and returning an error type from `check_expr_meets_expectation_or_error`.
Fixesrust-lang#96335
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Apr 25, 2022
…-errors
delay bug when adjusting `NeverToAny` twice during diagnostic code
Addresses Issue 96335 (rust-lang#96335) by using `delay_span_bug` instead of an assert and returning an error type from `check_expr_meets_expectation_or_error`.
Fixesrust-lang#96335
@Dylan-DPCDylan-DPC mentioned this pull request Apr 25, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 26, 2022
Rollup of 6 pull requests
Successful merges:
- rust-lang#90312 (Fix some confusing wording and improve slice-search-related docs)
- rust-lang#96149 (Remove unused macro rules)
- rust-lang#96279 (rustdoc: Remove .woff font files)
- rust-lang#96355 (Better handle too many `#` recovery in raw str)
- rust-lang#96379 (delay bug when adjusting `NeverToAny` twice during diagnostic code)
- rust-lang#96384 (do not consider two extern types to be similar)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 8038a9e into rust-lang:masterApr 26, 2022
@rustbotrustbot added this to the 1.62.0 milestone Apr 26, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

thread 'rustc' panicked at 'expression with never type wound up being adjusted'

5 participants

@PrestonFrom@rust-highfive@compiler-errors@bors@rustbot