2021-01-03 12:46:20 -06:00
|
|
|
// check-pass
|
2019-09-18 15:31:25 -05:00
|
|
|
#![feature(const_mut_refs)]
|
|
|
|
#![feature(raw_ref_op)]
|
|
|
|
|
|
|
|
struct Foo {
|
|
|
|
x: usize
|
|
|
|
}
|
|
|
|
|
|
|
|
const fn foo() -> Foo {
|
|
|
|
Foo { x: 0 }
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
const fn bar(&mut self) -> *mut usize {
|
|
|
|
&raw mut self.x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const fn baz(foo: &mut Foo)-> *mut usize {
|
|
|
|
&raw mut foo.x
|
|
|
|
}
|
|
|
|
|
|
|
|
const _: () = {
|
|
|
|
foo().bar();
|
|
|
|
baz(&mut foo());
|
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {}
|