Skip to content

Commit a0e3c71

Browse files
committed
Workaround issue 22462 by moving static value into its own module.
Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
1 parent 2d44712 commit a0e3c71

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/test/run-pass/drop-struct-as-object.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414
#![allow(unknown_features)]
1515
#![feature(box_syntax)]
1616

17-
static mut value: uint = 0;
17+
mod s {
18+
// FIXME(22181,22462) workaround hygiene issues between box
19+
// desugaring, macro-hygiene (or lack thereof) and static bindings
20+
// by forcing the static binding `value` into its own module.
21+
22+
pub static mut value: uint = 0;
23+
}
1824

1925
struct Cat {
2026
name : uint,
@@ -30,7 +36,7 @@ impl Dummy for Cat {
3036

3137
impl Drop for Cat {
3238
fn drop(&mut self) {
33-
unsafe { value = self.name; }
39+
unsafe { s::value = self.name; }
3440
}
3541
}
3642

@@ -40,6 +46,6 @@ pub fn main() {
4046
let nyan: Box<Dummy> = x as Box<Dummy>;
4147
}
4248
unsafe {
43-
assert_eq!(value, 22);
49+
assert_eq!(s::value, 22);
4450
}
4551
}

0 commit comments

Comments
 (0)