Skip to content

Commit 32a18ec

Browse files
committed
tuple indexing macro compat -> error
1 parent 13d2d7f commit 32a18ec

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

src/libsyntax/parse/literal.rs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -354,31 +354,19 @@ impl<'a> Parser<'a> {
354354

355355
crate fn expect_no_suffix(diag: &Handler, sp: Span, kind: &str, suffix: Option<Symbol>) {
356356
if let Some(suf) = suffix {
357-
let mut err = if kind == "a tuple index" &&
358-
[sym::i32, sym::u32, sym::isize, sym::usize].contains(&suf) {
359-
// #59553: warn instead of reject out of hand to allow the fix to percolate
360-
// through the ecosystem when people fix their macros
361-
let mut err = diag.struct_span_warn(
362-
sp,
363-
&format!("suffixes on {} are invalid", kind),
364-
);
365-
err.note(&format!(
366-
"`{}` is *temporarily* accepted on tuple index fields as it was \
367-
incorrectly accepted on stable for a few releases",
368-
suf,
369-
));
357+
let mut err = diag.struct_span_err(sp, &format!("suffixes on {} are invalid", kind));
358+
359+
if kind == "a tuple index"
360+
&& [sym::i32, sym::u32, sym::isize, sym::usize].contains(&suf)
361+
{
370362
err.help(
371363
"on proc macros, you'll want to use `syn::Index::from` or \
372-
`proc_macro::Literal::*_unsuffixed` for code that will desugar \
373-
to tuple field access",
374-
);
375-
err.note(
376-
"for more context, see https://github.com/rust-lang/rust/issues/60210",
364+
`proc_macro::Literal::*_unsuffixed` for code that will desugar \
365+
to tuple field access",
377366
);
378-
err
379-
} else {
380-
diag.struct_span_err(sp, &format!("suffixes on {} are invalid", kind))
381-
};
367+
err.note("for more context, see https://github.com/rust-lang/rust/issues/60210");
368+
}
369+
382370
err.span_label(sp, format!("invalid suffix `{}`", suf));
383371
err.emit();
384372
}

0 commit comments

Comments
 (0)