-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Introduce hir::ExprKind::Use and employ in for loop desugaring. #60225
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1366,6 +1366,7 @@ impl Expr { | |
ExprKind::Unary(..) => ExprPrecedence::Unary, | ||
ExprKind::Lit(_) => ExprPrecedence::Lit, | ||
ExprKind::Type(..) | ExprKind::Cast(..) => ExprPrecedence::Cast, | ||
ExprKind::Use(ref expr, ..) => expr.precedence(), | ||
ExprKind::If(..) => ExprPrecedence::If, | ||
ExprKind::While(..) => ExprPrecedence::While, | ||
ExprKind::Loop(..) => ExprPrecedence::Loop, | ||
|
@@ -1437,6 +1438,7 @@ impl Expr { | |
ExprKind::Binary(..) | | ||
ExprKind::Yield(..) | | ||
ExprKind::Cast(..) | | ||
ExprKind::Use(..) | | ||
ExprKind::Err => { | ||
false | ||
} | ||
|
@@ -1486,6 +1488,10 @@ pub enum ExprKind { | |
Cast(P<Expr>, P<Ty>), | ||
/// A type reference (e.g., `Foo`). | ||
Type(P<Expr>, P<Ty>), | ||
/// Semantically equivalent to `{ let _t = expr; _t }`. | ||
/// Maps directly to `hair::ExprKind::Use`. | ||
/// Only exists to tweak the drop order in HIR. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have more docs on where this is introduced and why it exists? As it stands it's pretty confusing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is used in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not asking you to explain it to me, I figured it out, I'm saying that this should be in the docs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure why not. Some parts haven't been merged yet so it would be slightly weird to talk about future events in the docs. Can you file an issue for now`? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't find the name... useful (sorry). I'd call this I believe that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @eddyb Fwiw, I contemplated |
||
Use(P<Expr>), | ||
/// An `if` block, with an optional else block. | ||
/// | ||
/// I.e., `if <expr> { <expr> } else { <expr> }`. | ||
|
Uh oh!
There was an error while loading. Please reload this page.