mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-01 20:47:36 +00:00
20 lines
270 B
Rust
20 lines
270 B
Rust
![]() |
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`
|
||
|
}
|