Unfortunately I haven't found an open bug on this subject.
I tried this code:
struct A(Vec<u32>);
impl A {
fn drain(self) -> Vec<u32> {
let mut nums = self.0;
nums.drain(..).collect() // error: `nums` does not live long enough
// but it works fine:
// return nums.drain(..).collect();
}
}
Try it