Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a regression test for issue-75801 #83671

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/test/ui/proc-macro/auxiliary/issue-75801.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_attribute]
pub fn foo(_args: TokenStream, item: TokenStream) -> TokenStream {
item
}
19 changes: 19 additions & 0 deletions src/test/ui/proc-macro/issue-75801.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// aux-build: issue-75801.rs

// Regression test for #75801.

#[macro_use]
extern crate issue_75801;

macro_rules! foo {
($arg:expr) => {
#[foo]
fn bar() {
let _bar: u32 = $arg;
}
};
}

foo!("baz"); //~ ERROR: mismatched types [E0308]

fn main() {}
12 changes: 12 additions & 0 deletions src/test/ui/proc-macro/issue-75801.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/issue-75801.rs:17:6
|
LL | let _bar: u32 = $arg;
| --- expected due to this
...
LL | foo!("baz");
| ^^^^^ expected `u32`, found `&str`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.