-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
delay bug when adjusting NeverToAny
twice during diagnostic code
#96379
Conversation
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. |
if self.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", | ||
); | ||
return self.tcx().ty_error(); | ||
} | ||
|
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.
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
:
if self.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", | |
); | |
return self.tcx().ty_error(); | |
} | |
if let Some(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", | |
); | |
if let [Adjustment { kind: Adjust::NeverToAny, target }] = &adjustments[..] { | |
return target; | |
} else { | |
return self.tcx().ty_error(); | |
} | |
} | |
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.
That's a great idea! Thank you!
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 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. |
7440327
to
a0c8790
Compare
a0c8790
to
5165295
Compare
Thank you for the quick review!!
I will certainly be using
I like that suggestion! |
NeverToAny
twice during diagnostic code
Thanks for the contribution. Fixing ICEs is totally rad. @bors r+ |
📌 Commit 5165295 has been approved by |
…-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`. Fixes rust-lang#96335
…-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`. Fixes rust-lang#96335
…-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`. Fixes rust-lang#96335
…-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`. Fixes rust-lang#96335
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
Addresses Issue 96335 (#96335) by using
delay_span_bug
instead of an assert and returning an error type fromcheck_expr_meets_expectation_or_error
.Fixes #96335