Skip to content

Commit f1ad4bd

Browse files
authored
Rollup merge of #83671 - JohnTitor:issue-75801-test, r=Dylan-DPC
Add a regression test for issue-75801 Closes #75801 r? ``@Aaron1011``
2 parents 7d888d1 + 4f2c25a commit f1ad4bd

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// force-host
2+
// no-prefer-dynamic
3+
4+
#![crate_type = "proc-macro"]
5+
6+
extern crate proc_macro;
7+
8+
use proc_macro::TokenStream;
9+
10+
#[proc_macro_attribute]
11+
pub fn foo(_args: TokenStream, item: TokenStream) -> TokenStream {
12+
item
13+
}

src/test/ui/proc-macro/issue-75801.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// aux-build: issue-75801.rs
2+
3+
// Regression test for #75801.
4+
5+
#[macro_use]
6+
extern crate issue_75801;
7+
8+
macro_rules! foo {
9+
($arg:expr) => {
10+
#[foo]
11+
fn bar() {
12+
let _bar: u32 = $arg;
13+
}
14+
};
15+
}
16+
17+
foo!("baz"); //~ ERROR: mismatched types [E0308]
18+
19+
fn main() {}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-75801.rs:17:6
3+
|
4+
LL | let _bar: u32 = $arg;
5+
| --- expected due to this
6+
...
7+
LL | foo!("baz");
8+
| ^^^^^ expected `u32`, found `&str`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)