From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/mismatched_types/abridged.rs | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/test/ui/mismatched_types/abridged.rs (limited to 'src/test/ui/mismatched_types/abridged.rs') diff --git a/src/test/ui/mismatched_types/abridged.rs b/src/test/ui/mismatched_types/abridged.rs new file mode 100644 index 000000000..9a5c183ca --- /dev/null +++ b/src/test/ui/mismatched_types/abridged.rs @@ -0,0 +1,62 @@ +enum Bar { + Qux, + Zar, +} + +struct Foo { + bar: usize, +} + +struct X { + x: T1, + y: T2, +} + +fn a() -> Foo { + Some(Foo { bar: 1 }) //~ ERROR mismatched types +} + +fn a2() -> Foo { + Ok(Foo { bar: 1}) //~ ERROR mismatched types +} + +fn b() -> Option { + Foo { bar: 1 } //~ ERROR mismatched types +} + +fn c() -> Result { + Foo { bar: 1 } //~ ERROR mismatched types +} + +fn d() -> X, String> { + let x = X { + x: X { + x: "".to_string(), + y: 2, + }, + y: 3, + }; + x //~ ERROR mismatched types +} + +fn e() -> X, String> { + let x = X { + x: X { + x: "".to_string(), + y: 2, + }, + y: "".to_string(), + }; + x //~ ERROR mismatched types +} + +fn f() -> String { + 1+2 //~ ERROR mismatched types +} + + +fn g() -> String { + -2 //~ ERROR mismatched types +} + +fn main() {} -- cgit v1.2.3