//@ run-rustfix #![allow(dead_code, noop_method_call)] use std::ops::Deref; struct S(Vec); impl Deref for S { type Target = Vec; 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() {}