mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-09 05:38:32 +00:00
16 lines
320 B
Rust
16 lines
320 B
Rust
![]() |
trait Hello {
|
||
|
fn example(val: ());
|
||
|
}
|
||
|
|
||
|
struct Test1(i32);
|
||
|
|
||
|
impl Hello for Test1 {
|
||
|
fn example(&self, input: &i32) {
|
||
|
//~^ ERROR `&self` declaration in the impl, but not in the trait
|
||
|
*input = self.0;
|
||
|
//~^ ERROR cannot assign to `*input`, which is behind a `&` reference
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() {}
|