-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add LetSource
to hir::ExprKind::Let
#88187
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 2 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 |
---|---|---|
|
@@ -122,8 +122,8 @@ struct LoweringContext<'a, 'hir: 'a> { | |
current_item: Option<Span>, | ||
|
||
catch_scopes: Vec<NodeId>, | ||
condition_scope: Option<ConditionScope>, | ||
loop_scopes: Vec<NodeId>, | ||
is_in_loop_condition: bool, | ||
is_in_trait_impl: bool, | ||
is_in_dyn_type: bool, | ||
|
||
|
@@ -332,8 +332,8 @@ pub fn lower_crate<'a, 'hir>( | |
attrs: BTreeMap::default(), | ||
non_exported_macro_attrs: Vec::new(), | ||
catch_scopes: Vec::new(), | ||
condition_scope: None, | ||
loop_scopes: Vec::new(), | ||
is_in_loop_condition: false, | ||
is_in_trait_impl: false, | ||
is_in_dyn_type: false, | ||
anonymous_lifetime_mode: AnonymousLifetimeMode::PassThrough, | ||
|
@@ -419,6 +419,13 @@ enum AnonymousLifetimeMode { | |
PassThrough, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, PartialEq)] | ||
enum ConditionScope { | ||
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. Why have separate LetSource and ConditionScope types? 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. Yeah I guess they are interchangeable. It's just that |
||
Guard, | ||
If, | ||
While, | ||
} | ||
|
||
impl<'a, 'hir> LoweringContext<'a, 'hir> { | ||
fn lower_crate(mut self, c: &Crate) -> &'hir hir::Crate<'hir> { | ||
/// Full-crate AST visitor that inserts into a fresh | ||
|
@@ -957,17 +964,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { | |
} | ||
|
||
fn with_new_scopes<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T { | ||
let was_in_loop_condition = self.is_in_loop_condition; | ||
self.is_in_loop_condition = false; | ||
|
||
let catch_scopes = mem::take(&mut self.catch_scopes); | ||
let condition_scope = mem::take(&mut self.condition_scope); | ||
let loop_scopes = mem::take(&mut self.loop_scopes); | ||
let ret = f(self); | ||
self.catch_scopes = catch_scopes; | ||
self.condition_scope = condition_scope; | ||
self.loop_scopes = loop_scopes; | ||
|
||
self.is_in_loop_condition = was_in_loop_condition; | ||
|
||
ret | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.