Skip to content

Commit 925ca49

Browse files
committed
Add test
1 parent 0acb786 commit 925ca49

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fn warn(_: &str) {}
2+
3+
macro_rules! intrinsic_match {
4+
($intrinsic:expr) => {
5+
warn(format!("unsupported intrinsic {}", $intrinsic));
6+
//^~ ERROR mismatched types
7+
};
8+
}
9+
10+
fn main() {
11+
intrinsic_match! {
12+
"abc"
13+
};
14+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/dont-suggest-deref-inside-macro-issue-58298.rs:10:5
3+
|
4+
LL | intrinsic_match! {
5+
| _____^
6+
| |_____|
7+
| ||
8+
LL | || "abc"
9+
LL | || };
10+
| || ^
11+
| ||______|
12+
| |_______expected &str, found struct `std::string::String`
13+
| in this macro invocation
14+
|
15+
= note: expected type `&str`
16+
found type `std::string::String`
17+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
18+
19+
error: aborting due to previous error
20+
21+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)