mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
24 lines
348 B
Rust
24 lines
348 B
Rust
#![allow(unused)]
|
|
|
|
struct X {
|
|
x: (),
|
|
}
|
|
pub trait A {
|
|
fn foo(&mut self, _: usize) -> &mut ();
|
|
}
|
|
impl A for X {
|
|
fn foo(&mut self, _: usize) -> &mut () {
|
|
&mut self.x
|
|
}
|
|
}
|
|
impl X {
|
|
fn foo(&mut self, _: usize) -> &mut Self {
|
|
self
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let mut x = X { x: () };
|
|
*x.foo(0) = (); //~ ERROR E0308
|
|
}
|