Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement RFC 2707 + Parser recovery for range patterns #62550

Merged
merged 34 commits into from
Jul 28, 2019
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f7c75cc
Add 'ast::PatKind::Rest'.
Centril Jul 6, 2019
ff77ef2
Introduce 'ast::Pat::is_rest(&self) -> bool'.
Centril Jul 9, 2019
633c997
Adjust 'ast::PatKind::{TupleStruct,Tuple,Slice}'.
Centril Jul 9, 2019
12250a2
Adjust feature gating of subslice patterns accordingly.
Centril Jul 9, 2019
b02941f
Adjust pretty printing accordingly.
Centril Jul 9, 2019
8ba5f49
Adjust and document 'Pat::to_ty' accordingly.
Centril Jul 9, 2019
d5df1e0
Adjust lowering of Tuple/TupleStruct patterns.
Centril Jul 9, 2019
694b3c3
Adjust lowering of Slice patterns.
Centril Jul 9, 2019
0a40ef2
Cleanup parse_seq_* methods + record trailing separators.
Centril Jul 9, 2019
7aeb4b7
Add more parse_*_seq methods for code reuse.
Centril Jul 9, 2019
7e1b671
Cleanup using the new parse_*_seq methods.
Centril Jul 9, 2019
62b29a1
Adjust parsing of Slice, Tuple, TupleStruct patterns.
Centril Jul 9, 2019
974413f
Recover on '..X' / '..=X' / '...X' range patterns.
Centril Jul 9, 2019
2f55354
Recover on 'X..' / 'X..=' / 'X...' range patterns.
Centril Jul 9, 2019
2411134
Update tests wrt. recovery of range patterns.
Centril Jul 9, 2019
f6c8234
And also --bless those recovery tests.
Centril Jul 9, 2019
891a736
Test parsing and recovery of all sorts of range patterns.
Centril Jul 9, 2019
75da43d
Use new 'p @ ..' syntax in tests.
Centril Jul 7, 2019
91c8b53
--bless tests due to new subslice syntax.
Centril Jul 7, 2019
e725ea2
Intersection patterns 'p1 @ p2' are not supported.
Centril Jul 8, 2019
06e5ae5
Account for better recovery in two cases.
Centril Jul 9, 2019
e3cdadd
(pat, ..,) is now syntactically legal.
Centril Jul 8, 2019
7c0b1da
Win some lose some; Unfortunately we lost recovery in one case.
Centril Jul 8, 2019
cec8649
Update unstable book wrt. subslice patterns.
Centril Jul 10, 2019
984f9db
Adjust documentation in HAIR.
Centril Jul 10, 2019
1060513
Get out of bootstrapping pickle.
Centril Jul 10, 2019
acc6a6d
--bless tests after rebase.
Centril Jul 10, 2019
59b5dae
Update error_codes.rs with new subslice syntax.
Centril Jul 10, 2019
397a027
Use AstP more in lowering.
Centril Jul 11, 2019
becdba8
Address comments in lowering + parsing.
Centril Jul 24, 2019
5f4dd1d
Address comments re. off-topic errors.
Centril Jul 24, 2019
18ccd6a
Add exceptions for ExprKind::Err/TyKind::Error.
Centril Jul 24, 2019
8774207
And --bless tests accordingly for those exceptions.
Centril Jul 24, 2019
d33696f
borrowck-describe-lvalue: --bless --compare-mode=nll.
Centril Jul 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjust feature gating of subslice patterns accordingly.
  • Loading branch information
Centril committed Jul 28, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 12250a2017b1a9837f918905e870761a0a03bfaf
22 changes: 17 additions & 5 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
@@ -2151,11 +2151,23 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}

fn visit_pat(&mut self, pattern: &'a ast::Pat) {
match pattern.node {
PatKind::Slice(_, Some(ref subslice), _) => {
gate_feature_post!(&self, slice_patterns,
subslice.span,
"syntax for subslices in slice patterns is not yet stabilized");
match &pattern.node {
PatKind::Slice(pats) => {
for pat in &*pats {
let span = pat.span;
let inner_pat = match &pat.node {
PatKind::Ident(.., Some(pat)) => pat,
_ => pat,
};
if inner_pat.is_rest() {
gate_feature_post!(
&self,
slice_patterns,
span,
"subslice patterns are unstable"
);
}
}
}
PatKind::Box(..) => {
gate_feature_post!(&self, box_patterns,