Allow exclusive range-from patterns
This commit is contained in:
parent
a7e808ed25
commit
91bc117e53
@ -548,7 +548,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
|||||||
"box pattern syntax is experimental"
|
"box pattern syntax is experimental"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
PatKind::Range(_, _, Spanned { node: RangeEnd::Excluded, .. }) => {
|
PatKind::Range(_, Some(_), Spanned { node: RangeEnd::Excluded, .. }) => {
|
||||||
gate_feature_post!(
|
gate_feature_post!(
|
||||||
&self,
|
&self,
|
||||||
exclusive_range_pattern,
|
exclusive_range_pattern,
|
||||||
|
@ -715,7 +715,6 @@ impl<'a> Parser<'a> {
|
|||||||
} else if self.eat(&token::DotDotEq) {
|
} else if self.eat(&token::DotDotEq) {
|
||||||
RangeEnd::Included(RangeSyntax::DotDotEq)
|
RangeEnd::Included(RangeSyntax::DotDotEq)
|
||||||
} else if self.eat(&token::DotDot) {
|
} else if self.eat(&token::DotDot) {
|
||||||
self.sess.gated_spans.gate(sym::exclusive_range_pattern, self.prev_token.span);
|
|
||||||
RangeEnd::Excluded
|
RangeEnd::Excluded
|
||||||
} else {
|
} else {
|
||||||
return None;
|
return None;
|
||||||
@ -735,7 +734,6 @@ impl<'a> Parser<'a> {
|
|||||||
Some(self.parse_pat_range_end()?)
|
Some(self.parse_pat_range_end()?)
|
||||||
} else {
|
} else {
|
||||||
// Parsing e.g. `X..`.
|
// Parsing e.g. `X..`.
|
||||||
self.sess.gated_spans.gate(sym::half_open_range_patterns, begin.span.to(re.span));
|
|
||||||
if let RangeEnd::Included(_) = re.node {
|
if let RangeEnd::Included(_) = re.node {
|
||||||
// FIXME(Centril): Consider semantic errors instead in `ast_validation`.
|
// FIXME(Centril): Consider semantic errors instead in `ast_validation`.
|
||||||
// Possibly also do this for `X..=` in *expression* contexts.
|
// Possibly also do this for `X..=` in *expression* contexts.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user