Skip to content

syntax: cleanup param, method, and misc parsing #64910

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

Merged
merged 21 commits into from
Oct 2, 2019
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion src/libsyntax/parse/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1180,7 +1180,7 @@ impl<'a> Parser<'a> {
}
}

crate fn expected_semi_or_open_brace(&mut self) -> PResult<'a, ast::TraitItem> {
crate fn expected_semi_or_open_brace<T>(&mut self) -> PResult<'a, T> {
let token_str = self.this_token_descr();
let mut err = self.fatal(&format!("expected `;` or `{{`, found {}", token_str));
err.span_label(self.token.span, "expected `;` or `{`");
655 changes: 330 additions & 325 deletions src/libsyntax/parse/parser.rs

Large diffs are not rendered by default.

393 changes: 162 additions & 231 deletions src/libsyntax/parse/parser/item.rs

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions src/libsyntax/parse/parser/ty.rs
Original file line number Diff line number Diff line change
@@ -231,19 +231,15 @@ impl<'a> Parser<'a> {
}

fn parse_ptr(&mut self) -> PResult<'a, MutTy> {
let mutbl = if self.eat_keyword(kw::Mut) {
Mutability::Mutable
} else if self.eat_keyword(kw::Const) {
Mutability::Immutable
} else {
let mutbl = self.parse_const_or_mut().unwrap_or_else(|| {
let span = self.prev_span;
let msg = "expected mut or const in raw pointer type";
self.struct_span_err(span, msg)
.span_label(span, msg)
.help("use `*mut T` or `*const T` as appropriate")
.emit();
Mutability::Immutable
};
});
let t = self.parse_ty_no_plus()?;
Ok(MutTy { ty: t, mutbl })
}
12 changes: 6 additions & 6 deletions src/test/ui/async-await/edition-deny-async-fns-2015.stderr
Original file line number Diff line number Diff line change
@@ -10,18 +10,18 @@ error[E0670]: `async fn` is not permitted in the 2015 edition
LL | fn baz() { async fn foo() {} }
| ^^^^^

error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:8:5
|
LL | async fn bar() {}
| ^^^^^

error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:7:1
|
LL | async fn async_baz() {
| ^^^^^

error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:8:5
|
LL | async fn bar() {}
| ^^^^^

error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:14:5
|