aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-05-21 18:09:14 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-06-12 11:11:56 +0000
commit956542656fe2fc39c14b99b87ef2cae21928d6e6 (patch)
tree71962341abee2a28b6c3d4446ec4150c53cd8304 /gcc/rust/parse/rust-parse-impl.h
parenta178a07e4322fca9bd3c4b12d3d1da32bedfe198 (diff)
downloadgcc-956542656fe2fc39c14b99b87ef2cae21928d6e6.zip
gcc-956542656fe2fc39c14b99b87ef2cae21928d6e6.tar.gz
gcc-956542656fe2fc39c14b99b87ef2cae21928d6e6.tar.bz2
Add exclusive_range_pattern feature gate
This syntax is experimental and shall be explicitely enabled in the crate attributes as it cannot be used in stable rust. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc (FeatureGate::visit): Gate the excluded pattern. * checks/errors/rust-feature-gate.h: Update the function prototype and delete two empty implementations in order to use default visitor behavior. * checks/errors/rust-feature.cc (Feature::create): Add the new exclusive range pattern feature gate. * checks/errors/rust-feature.h: Add new feature enum variant for exclusive range patterns. * parse/rust-parse-impl.h (Parser::parse_pattern_no_alt): Forward the token location to the AST. (Parser::parse_ident_leading_pattern): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index db5c3c0..0a20bf6 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -10586,7 +10586,7 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
return std::unique_ptr<AST::RangePattern> (
new AST::RangePattern (std::move (lower_bound),
std::move (upper_bound), kind,
- UNKNOWN_LOCATION));
+ next->get_locus ()));
}
case EXCLAM:
return parse_macro_invocation_partial (std::move (path),
@@ -11112,7 +11112,7 @@ Parser<ManagedTokenSource>::parse_ident_leading_pattern ()
return std::unique_ptr<AST::RangePattern> (
new AST::RangePattern (std::move (lower_bound),
std::move (upper_bound), kind,
- UNKNOWN_LOCATION));
+ t->get_locus ()));
}
case PATTERN_BIND: {
// only allow on single-segment paths