Skip to content

Commit 0e3fd88

Browse files
committed
Add ui test
Signed-off-by: xizheyin <[email protected]>
1 parent ae8ab87 commit 0e3fd88

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#[derive(Clone, Debug)]
2+
struct Point<T> {
3+
v: T,
4+
}
5+
6+
macro_rules! local_macro {
7+
($val:expr $(,)?) => {
8+
match $val {
9+
tmp => tmp, //~ ERROR mismatched types [E0308]
10+
}
11+
};
12+
}
13+
14+
fn main() {
15+
let a: Point<u8> = dbg!(Point { v: 42 });
16+
let b: Point<u8> = dbg!(&a); //~ ERROR mismatched types [E0308]
17+
let c: Point<u8> = local_macro!(&a);
18+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/suggest-in-extern-macro-issue-139253.rs:16:24
3+
|
4+
LL | let b: Point<u8> = dbg!(&a);
5+
| ^^^^^^^^ expected `Point<u8>`, found `&Point<u8>`
6+
|
7+
= note: expected struct `Point<_>`
8+
found reference `&Point<_>`
9+
= note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
10+
11+
error[E0308]: mismatched types
12+
--> $DIR/suggest-in-extern-macro-issue-139253.rs:9:20
13+
|
14+
LL | tmp => tmp,
15+
| ^^^ expected `Point<u8>`, found `&Point<u8>`
16+
...
17+
LL | let c: Point<u8> = local_macro!(&a);
18+
| ---------------- in this macro invocation
19+
|
20+
= note: expected struct `Point<_>`
21+
found reference `&Point<_>`
22+
= note: this error originates in the macro `local_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
23+
help: consider using clone here
24+
|
25+
LL | tmp => tmp.clone(),
26+
| ++++++++
27+
28+
error: aborting due to 2 previous errors
29+
30+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)