We currently erroneously accept programs like the following:
#![feature(where_clause_attrs)]
struct S where #[allow()];
// ~~~~~~~~~~ doesn't annotate anything; not present in the AST
#![feature(where_clause_attrs)]
fn f() where #[cfg(false)] {}
// ~~~~~~~~~~~~~ doesn't annotate anything; not present in the AST
#![feature(where_clause_attrs)]
fn f<T>()
where
T: Copy,
#[cfg(true)] // these two don't annotate anything;
#[cfg(false)] // they're absent from the AST
{}
Compare this with e.g.,
fn f(#[allow()]) {} where we emit expected parameter name, found ) or
struct X<#[allow()]>; which we reject with attribute without generic parameters or
fn f() { #[allow()] } for which we report expected statement after outer attribute and so on.
Note
Similar to #152820, this was found thanks to @matthiaskrgr fuzzing fmease/rasur versus rustc.
Downstream report: fmease/rasur#33.
We currently erroneously accept programs like the following:
Compare this with e.g.,
fn f(#[allow()]) {}where we emit expected parameter name, found)orstruct X<#[allow()]>;which we reject with attribute without generic parameters orfn f() { #[allow()] }for which we report expected statement after outer attribute and so on.