Skip to content

Commit f91161d

Browse files
author
Sasha Pourcelot
committed
last_closure_body -> current_closure
1 parent e9e8b61 commit f91161d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compiler/rustc_parse/src/parser/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'a> Parser<'a> {
9494
/// Parses an expression.
9595
#[inline]
9696
pub fn parse_expr(&mut self) -> PResult<'a, P<Expr>> {
97-
self.last_closure_body.take();
97+
self.current_closure.take();
9898

9999
self.parse_expr_res(Restrictions::empty(), None)
100100
}
@@ -1757,7 +1757,7 @@ impl<'a> Parser<'a> {
17571757
// Disable recovery for closure body
17581758
let spans =
17591759
ClosureSpans { whole_closure: closure.span, closing_pipe: decl_hi, body: body_span };
1760-
self.last_closure_body = Some(spans);
1760+
self.current_closure = Some(spans);
17611761

17621762
Ok(closure)
17631763
}

compiler/rustc_parse/src/parser/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub struct Parser<'a> {
144144
capture_state: CaptureState,
145145
/// This allows us to recover when the user forget to add braces around
146146
/// multiple statements in the closure body.
147-
pub last_closure_body: Option<ClosureSpans>,
147+
pub current_closure: Option<ClosureSpans>,
148148
}
149149

150150
/// Stores span informations about a closure.
@@ -451,7 +451,7 @@ impl<'a> Parser<'a> {
451451
replace_ranges: Vec::new(),
452452
inner_attr_ranges: Default::default(),
453453
},
454-
last_closure_body: None,
454+
current_closure: None,
455455
};
456456

457457
// Make parser point to the first token.
@@ -774,18 +774,18 @@ impl<'a> Parser<'a> {
774774
} else {
775775
match self.expect(t) {
776776
Ok(false) => {
777-
self.last_closure_body.take();
777+
self.current_closure.take();
778778
}
779779
Ok(true) => {
780-
self.last_closure_body.take();
780+
self.current_closure.take();
781781
recovered = true;
782782
break;
783783
}
784784
Err(mut expect_err) => {
785785
let sp = self.prev_token.span.shrink_to_hi();
786786
let token_str = pprust::token_kind_to_string(t);
787787

788-
match self.last_closure_body.take() {
788+
match self.current_closure.take() {
789789
Some(closure_spans) if self.token.kind == TokenKind::Semi => {
790790
// Finding a semicolon instead of a comma
791791
// after a closure body indicates that the

0 commit comments

Comments
 (0)