Skip to content

Commit 2eb883e

Browse files
committed
Pass Recovery down to rustc_parse's Parser
1 parent 52c417d commit 2eb883e

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

compiler/rustc_attr_parsing/src/parser.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,10 @@ impl<'a, 'sess> MetaItemListParserContext<'a, 'sess> {
575575
should_emit: ShouldEmit,
576576
) -> PResult<'sess, MetaItemListParser> {
577577
let mut parser = Parser::new(psess, tokens, None);
578+
if let ShouldEmit::ErrorsAndLints { recovery } = should_emit {
579+
parser = parser.recovery(recovery);
580+
}
581+
578582
let mut this = MetaItemListParserContext { parser: &mut parser, should_emit };
579583

580584
// Presumably, the majority of the time there will only be one attr.

tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
22
--> $DIR/does_not_acccept_args.rs:12:1
33
|
4-
LL | #[diagnostic::do_not_recommend(not_accepted)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | #[diagnostic::do_not_recommend(if, crate, do yeet, false, dyn, abstract, gen, not_accepted)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
88

tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
22
--> $DIR/does_not_acccept_args.rs:12:1
33
|
4-
LL | #[diagnostic::do_not_recommend(not_accepted)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | #[diagnostic::do_not_recommend(if, crate, do yeet, false, dyn, abstract, gen, not_accepted)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
88

tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trait Bar {}
99
trait Baz {}
1010
trait Boo {}
1111

12-
#[diagnostic::do_not_recommend(not_accepted)]
12+
#[diagnostic::do_not_recommend(if, crate, do yeet, false, dyn, abstract, gen, not_accepted)]
1313
//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
1414
impl<T> Foo for T where T: Send {}
1515

0 commit comments

Comments
 (0)