1
Fork 0

Keep the suggestion for wrong arbitrary self types

This commit is contained in:
Mu001999 2023-08-03 00:00:56 +08:00
parent 049c728c60
commit 89b2fe7750
15 changed files with 133 additions and 80 deletions

View file

@ -775,7 +775,7 @@ impl<'a> Parser<'a> {
_ => {}
}
match self.parse_path(PathStyle::Expr) {
match self.parse_path(PathStyle::Expr, None) {
Ok(path) => {
let span_after_type = parser_snapshot_after_type.token.span;
let expr = mk_expr(
@ -1314,7 +1314,7 @@ impl<'a> Parser<'a> {
}
let fn_span_lo = self.token.span;
let mut seg = self.parse_path_segment(PathStyle::Expr, None)?;
let mut seg = self.parse_path_segment(PathStyle::Expr, None, None)?;
self.check_trailing_angle_brackets(&seg, &[&token::OpenDelim(Delimiter::Parenthesis)]);
self.check_turbofish_missing_angle_brackets(&mut seg);
@ -1544,7 +1544,7 @@ impl<'a> Parser<'a> {
})?;
(Some(qself), path)
} else {
(None, self.parse_path(PathStyle::Expr)?)
(None, self.parse_path(PathStyle::Expr, None)?)
};
// `!`, as an operator, is prefix, so we know this isn't that.
@ -2338,7 +2338,7 @@ impl<'a> Parser<'a> {
let lo = self.token.span;
let attrs = self.parse_outer_attributes()?;
self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| {
let pat = this.parse_pat_no_top_alt(Some(Expected::ParameterName))?;
let pat = this.parse_pat_no_top_alt(Some(Expected::ParameterName), None)?;
let ty = if this.eat(&token::Colon) {
this.parse_ty()?
} else {
@ -2781,7 +2781,7 @@ impl<'a> Parser<'a> {
return None;
}
let pre_pat_snapshot = self.create_snapshot_for_diagnostic();
match self.parse_pat_no_top_alt(None) {
match self.parse_pat_no_top_alt(None, None) {
Ok(_pat) => {
if self.token.kind == token::FatArrow {
// Reached arm end.