mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
19 lines
404 B
Rust
19 lines
404 B
Rust
//@ run-rustfix
|
|
#![allow(dead_code, noop_method_call)]
|
|
use std::ops::Deref;
|
|
struct S(Vec<usize>);
|
|
impl Deref for S {
|
|
type Target = Vec<usize>;
|
|
fn deref(&self) -> &Self::Target {
|
|
&self.0
|
|
}
|
|
}
|
|
|
|
impl S {
|
|
fn foo(&self) {
|
|
// `self.clone()` returns `&S`, not `Vec`
|
|
for _ in self.clone().into_iter() {} //~ ERROR cannot move out of dereference of `S`
|
|
}
|
|
}
|
|
fn main() {}
|