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:
David Wood 2019-03-12 16:53:33 +01:00
parent 8b57be1bb3
commit 41c6bb1096
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
9 changed files with 46 additions and 4 deletions

View file

@ -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'.