Use expect_no_suffix
for error
This commit is contained in:
parent
6ad77b0938
commit
c7ddb83980
@ -3205,14 +3205,7 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P<Expr>, lo: Span) -> PResult<'a,
|
||||
let field = ExprKind::Field(e, Ident::new(name, span));
|
||||
e = self.mk_expr(lo.to(span), field, ThinVec::new());
|
||||
|
||||
if let Some(suffix) = suffix {
|
||||
let mut err = self.diagnostic().struct_span_err(
|
||||
span,
|
||||
"suffixes on tuple indexes are invalid",
|
||||
);
|
||||
err.span_label(span, format!("invalid suffix `{}`", suffix));
|
||||
err.emit();
|
||||
}
|
||||
self.expect_no_suffix(span, "tuple index", suffix);
|
||||
}
|
||||
token::Literal(token::Float(n), _suf) => {
|
||||
self.bump();
|
||||
|
@ -3,11 +3,10 @@
|
||||
fn main() {
|
||||
let a = X(1, 2, 3);
|
||||
let b = a.1suffix;
|
||||
//~^ ERROR suffixes on tuple indexes are invalid
|
||||
//~^ ERROR tuple index with a suffix is invalid
|
||||
println!("{}", b);
|
||||
let c = (1, 2, 3);
|
||||
let d = c.1suffix;
|
||||
//~^ ERROR suffixes on tuple indexes are invalid
|
||||
//~^ ERROR tuple index with a suffix is invalid
|
||||
println!("{}", d);
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
error: suffixes on tuple indexes are invalid
|
||||
error: tuple index with a suffix is invalid
|
||||
--> $DIR/issue-59418.rs:5:15
|
||||
|
|
||||
LL | let b = a.1suffix;
|
||||
| ^^^^^^^ invalid suffix `suffix`
|
||||
| ^^^^^^^ tuple index with a suffix is invalid
|
||||
|
||||
error: suffixes on tuple indexes are invalid
|
||||
error: tuple index with a suffix is invalid
|
||||
--> $DIR/issue-59418.rs:9:15
|
||||
|
|
||||
LL | let d = c.1suffix;
|
||||
| ^^^^^^^ invalid suffix `suffix`
|
||||
| ^^^^^^^ tuple index with a suffix is invalid
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user