rust/tests/ui/moves/issue-34721.fixed
Lukas Wirth eae7fe1bdb Use non-2015 edition paths in tests that do not test for their resolution
This allows for testing these tests on editions other than 2015
2025-06-03 13:35:31 +02:00

35 lines
516 B
Rust

//@ run-rustfix
pub trait Foo {
fn zero(self) -> Self;
}
impl Foo for u32 {
fn zero(self) -> u32 { 0u32 }
}
pub mod bar {
pub use crate::Foo;
pub fn bar<T: Foo>(x: T) -> T {
x.zero()
}
}
mod baz {
use crate::bar;
use crate::Foo;
pub fn baz<T: Foo + Copy>(x: T) -> T {
if 0 == 1 {
bar::bar(x.zero())
} else {
x.zero()
};
x.zero()
//~^ ERROR use of moved value
}
}
fn main() {
let _ = baz::baz(0u32);
}