Implement the new homogeneous & heterogeneous try blocks#21572
Merged
ChayimFriedman2 merged 3 commits intorust-lang:masterfrom Feb 3, 2026
Merged
Implement the new homogeneous & heterogeneous try blocks#21572ChayimFriedman2 merged 3 commits intorust-lang:masterfrom
ChayimFriedman2 merged 3 commits intorust-lang:masterfrom
Conversation
Contributor
Author
|
(i previously stated that type inference was broken, but I was just missing a minicore import) |
ChayimFriedman2
approved these changes
Feb 2, 2026
Contributor
ChayimFriedman2
left a comment
There was a problem hiding this comment.
Overall LGTM, have a few comments.
| self.current_try_block = old_try_block; | ||
| match result_type { | ||
| Some(ty) => { | ||
| // `{ let <name>: <ty> = <expr>; <name> }` |
Contributor
There was a problem hiding this comment.
Technically in the MIR forcing a type is not the same as introducing a new local variable, but our MIR is horribly broken anyway and I believe in typeck the effect should be the same.
Contributor
Author
There was a problem hiding this comment.
You are correct of course, but I don't think we have a construct for type ascription in an expression (which is what rustc uses) :')
goffrie
commented
Feb 3, 2026
| HygieneId::ROOT, | ||
| ); | ||
| let pat = self.alloc_pat_desugared(Pat::Bind { id: binding, subpat: None }); | ||
| self.add_definition_to_binding(binding, pat); |
Contributor
Author
There was a problem hiding this comment.
i think i was missing this add_definition_to_binding before but I confess that I don't know what it actually does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Match rust-lang/rust#148725 / rust-lang/rust#149489 from rustc nightly.
This adds parser support for the bikeshed syntax & desugaring.