forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#137758 - jdonszelmann:fix-137662, r=nnether…
…cote fix usage of ty decl macro fragments in attributes See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way. Closes rust-lang#137662
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// tests for #137662: using a ty or (or most other) fragment inside an attr macro wouldn't work | ||
// because of a missing code path. With $repr: tt it did work. | ||
//@ check-pass | ||
|
||
macro_rules! foo { | ||
{ | ||
$repr:ty | ||
} => { | ||
#[repr($repr)] | ||
pub enum Foo { | ||
Bar = 0i32, | ||
} | ||
} | ||
} | ||
|
||
foo! { | ||
i32 | ||
} | ||
|
||
fn main() {} |