Skip to content

Commit f043d2d

Browse files
committed
Revise test slightly so that dyn in macro invocation *must* be parsed as keyword in test.
Back-story: After reflection this morning, I realized that the previous form of this test would allow the macro invocation to treat the `dyn` input as a raw-identifier rather than a keyword, and since the input was discarded by that version of the macro, the test would pass despite the detail that the input `dyn` should not have been parsed as a raw-identifier. This revision fixes that oversight, by actually *using* the macro input to construct a `Box<dyn Trait>` type.
1 parent 1f63a52 commit f043d2d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod macro_defn {
4545
//~| WARN was previously accepted
4646

4747
// Note that we do not lint nor fix occurrences under macros
48-
($dyn:ident) => { Box<dyn Trait> }
48+
($dyn:tt) => { (Box<dyn Trait>, Box<$dyn Trait>) }
4949
}
5050

5151
pub fn r#dyn() -> ::outer_mod::r#dyn::r#dyn {
@@ -72,7 +72,7 @@ mod macro_defn {
7272
dyn
7373
)
7474
{
75-
Box::new(10)
75+
(Box::new(1), Box::new(2))
7676
}
7777
}
7878

src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod macro_defn {
4545
//~| WARN was previously accepted
4646

4747
// Note that we do not lint nor fix occurrences under macros
48-
($dyn:ident) => { Box<dyn Trait> }
48+
($dyn:tt) => { (Box<dyn Trait>, Box<$dyn Trait>) }
4949
}
5050

5151
pub fn dyn() -> ::outer_mod::dyn::dyn {
@@ -72,7 +72,7 @@ mod macro_defn {
7272
dyn
7373
)
7474
{
75-
Box::new(10)
75+
(Box::new(1), Box::new(2))
7676
}
7777
}
7878

0 commit comments

Comments
 (0)