Rollup merge of #117990 - estebank:issue-100825-part-deux, r=Nilstrieb
Tweak error and move tests r? `@Nilstrieb` Split off #117565.
This commit is contained in:
commit
a5d7f8bcf2
65 changed files with 77 additions and 15 deletions
|
@ -830,8 +830,8 @@ impl<'a> Parser<'a> {
|
|||
// https://github.com/rust-lang/rust/issues/72373
|
||||
if self.prev_token.is_ident() && self.token.kind == token::DotDot {
|
||||
let msg = format!(
|
||||
"if you meant to bind the contents of \
|
||||
the rest of the array pattern into `{}`, use `@`",
|
||||
"if you meant to bind the contents of the rest of the array \
|
||||
pattern into `{}`, use `@`",
|
||||
pprust::token_to_string(&self.prev_token)
|
||||
);
|
||||
expect_err
|
||||
|
|
|
@ -638,13 +638,13 @@ impl<'a> Parser<'a> {
|
|||
|
||||
/// Error on `mut $pat` where `$pat` is not an ident.
|
||||
fn ban_mut_general_pat(&self, lo: Span, pat: &Pat, changed_any_binding: bool) {
|
||||
let span = lo.to(pat.span);
|
||||
let pat = pprust::pat_to_string(&pat);
|
||||
|
||||
self.sess.emit_err(if changed_any_binding {
|
||||
InvalidMutInPattern::NestedIdent { span, pat }
|
||||
InvalidMutInPattern::NestedIdent {
|
||||
span: lo.to(pat.span),
|
||||
pat: pprust::pat_to_string(&pat),
|
||||
}
|
||||
} else {
|
||||
InvalidMutInPattern::NonIdent { span, pat }
|
||||
InvalidMutInPattern::NonIdent { span: lo.until(pat.span) }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue