Feature gate 'yield ?' pre-expansion.
This commit is contained in:
parent
9dd5c19199
commit
4087fc583e
5 changed files with 38 additions and 6 deletions
|
|
@ -63,6 +63,8 @@ pub struct ParseSess {
|
|||
pub let_chains_spans: Lock<Vec<Span>>,
|
||||
// Places where `async || ..` exprs were used and should be feature gated.
|
||||
pub async_closure_spans: Lock<Vec<Span>>,
|
||||
// Places where `yield e?` exprs were used and should be feature gated.
|
||||
pub yield_spans: Lock<Vec<Span>>,
|
||||
pub injected_crate_name: Once<Symbol>,
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +94,7 @@ impl ParseSess {
|
|||
param_attr_spans: Lock::new(Vec::new()),
|
||||
let_chains_spans: Lock::new(Vec::new()),
|
||||
async_closure_spans: Lock::new(Vec::new()),
|
||||
yield_spans: Lock::new(Vec::new()),
|
||||
injected_crate_name: Once::new(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -997,6 +997,9 @@ impl<'a> Parser<'a> {
|
|||
} else {
|
||||
ex = ExprKind::Yield(None);
|
||||
}
|
||||
|
||||
let span = lo.to(hi);
|
||||
self.sess.yield_spans.borrow_mut().push(span);
|
||||
} else if self.eat_keyword(kw::Let) {
|
||||
return self.parse_let_expr(attrs);
|
||||
} else if is_span_rust_2018 && self.eat_keyword(kw::Await) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue