avoid delayed-bug ICE for malformed diagnostic attrs
remove -Znext-solver from ui tests
This commit is contained in:
parent
3f6250a7bb
commit
61c9af20c7
3 changed files with 27 additions and 0 deletions
|
|
@ -522,6 +522,13 @@ impl<'a, 'sess> MetaItemListParserContext<'a, 'sess> {
|
|||
return self.parser.dcx().create_err(err);
|
||||
}
|
||||
|
||||
if let ShouldEmit::ErrorsAndLints { recovery: Recovery::Forbidden } = self.should_emit {
|
||||
// Do not attempt to suggest anything in `Recovery::Forbidden` mode.
|
||||
// Malformed diagnostic-attr arguments that start with an `if` expression can lead to
|
||||
// an ICE (https://github.com/rust-lang/rust/issues/152744), because callers may cancel the `InvalidMetaItem` error.
|
||||
return self.parser.dcx().create_err(err);
|
||||
}
|
||||
|
||||
// Suggest quoting idents, e.g. in `#[cfg(key = value)]`. We don't use `Token::ident` and
|
||||
// don't `uninterpolate` the token to avoid suggesting anything butchered or questionable
|
||||
// when macro metavariables are involved.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
//@ check-pass
|
||||
//@ reference: attributes.diagnostic.do_not_recommend.syntax
|
||||
|
||||
trait Foo {}
|
||||
|
||||
#[diagnostic::do_not_recommend(if not_accepted)]
|
||||
//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
impl Foo for () {}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/malformed-diagnostic-attributes-if-expression.rs:6:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(if not_accepted)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue