rust/tests/ui/structs/ident-from-macro-expansion.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
270 B
Rust
Raw Normal View History

struct Foo {
inner: Inner,
}
struct Inner {
y: i32,
}
macro_rules! access {
($expr:expr, $ident:ident) => {
$expr.$ident
}
}
fn main() {
let k = Foo { inner: Inner { y: 0 } };
access!(k, y);
//~^ ERROR no field `y` on type `Foo`
}