Don't give APITs names with macro expansion placeholder fragments in it
This commit is contained in:
parent
2801f9aaf9
commit
8cd3fa04e2
9 changed files with 77 additions and 18 deletions
|
|
@ -1,9 +0,0 @@
|
|||
//@ known-bug: #140333
|
||||
fn a() -> impl b<
|
||||
[c; {
|
||||
struct d {
|
||||
#[a]
|
||||
bar: e,
|
||||
}
|
||||
}],
|
||||
>;
|
||||
12
tests/ui/impl-trait/name-mentioning-macro.rs
Normal file
12
tests/ui/impl-trait/name-mentioning-macro.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
trait Foo<T> {}
|
||||
|
||||
macro_rules! bar {
|
||||
() => { () }
|
||||
}
|
||||
|
||||
fn foo(x: impl Foo<bar!()>) {
|
||||
let () = x;
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
16
tests/ui/impl-trait/name-mentioning-macro.stderr
Normal file
16
tests/ui/impl-trait/name-mentioning-macro.stderr
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/name-mentioning-macro.rs:8:9
|
||||
|
|
||||
LL | fn foo(x: impl Foo<bar!()>) {
|
||||
| ---------------- expected this type parameter
|
||||
LL | let () = x;
|
||||
| ^^ - this expression has type `impl Foo<bar!()>`
|
||||
| |
|
||||
| expected type parameter `impl Foo<bar!()>`, found `()`
|
||||
|
|
||||
= note: expected type parameter `impl Foo<bar!()>`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
16
tests/ui/impl-trait/struct-field-fragment-in-name.rs
Normal file
16
tests/ui/impl-trait/struct-field-fragment-in-name.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//@ check-pass
|
||||
|
||||
trait Trait<T> {}
|
||||
|
||||
fn a(_: impl Trait<
|
||||
[(); {
|
||||
struct D {
|
||||
#[rustfmt::skip]
|
||||
bar: (),
|
||||
}
|
||||
0
|
||||
}],
|
||||
>) {
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue