Introduce LocalSource into the AST.
This will be used to keep track of the origin of a local in the AST. In particular, it will be used by `async fn` lowering for the locals in `let <pat>: <ty> = __arg0;` statements.
This commit is contained in:
parent
8b57be1bb3
commit
41c6bb1096
9 changed files with 46 additions and 4 deletions
|
|
@ -888,6 +888,17 @@ pub struct Local {
|
|||
pub id: NodeId,
|
||||
pub span: Span,
|
||||
pub attrs: ThinVec<Attribute>,
|
||||
/// Origin of this local variable.
|
||||
pub source: LocalSource,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug)]
|
||||
pub enum LocalSource {
|
||||
/// Local was parsed from source.
|
||||
Normal,
|
||||
/// Within `ast::IsAsync::Async`, a local is generated that will contain the moved arguments
|
||||
/// of an `async fn`.
|
||||
AsyncFn,
|
||||
}
|
||||
|
||||
/// An arm of a 'match'.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue