From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/moves/issue-34721.fixed | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/ui/moves/issue-34721.fixed (limited to 'tests/ui/moves/issue-34721.fixed') diff --git a/tests/ui/moves/issue-34721.fixed b/tests/ui/moves/issue-34721.fixed new file mode 100644 index 000000000..f135ad383 --- /dev/null +++ b/tests/ui/moves/issue-34721.fixed @@ -0,0 +1,34 @@ +// run-rustfix + +pub trait Foo { + fn zero(self) -> Self; +} + +impl Foo for u32 { + fn zero(self) -> u32 { 0u32 } +} + +pub mod bar { + pub use Foo; + pub fn bar(x: T) -> T { + x.zero() + } +} + +mod baz { + use bar; + use Foo; + pub fn baz(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); +} -- cgit v1.2.3