blob: f7243294669a62134f356638e1165a45a9978885 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Regression test for #46314
#![feature(decl_macro)]
struct NonCopy(String);
struct Wrapper {
inner: NonCopy,
}
macro inner_copy($wrapper:ident) {
$wrapper.inner
}
fn main() {
let wrapper = Wrapper {
inner: NonCopy("foo".into()),
};
assert_two_non_copy(
inner_copy!(wrapper),
wrapper.inner,
//~^ ERROR use of moved value: `wrapper.inner` [E0382]
);
}
fn assert_two_non_copy(a: NonCopy, b: NonCopy) {
assert_eq!(a.0, b.0);
}
|