summaryrefslogtreecommitdiffstats
path: root/src/test/ui/pattern/pat-type-err-let-stmt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/pattern/pat-type-err-let-stmt.rs')
-rw-r--r--src/test/ui/pattern/pat-type-err-let-stmt.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/pattern/pat-type-err-let-stmt.rs b/src/test/ui/pattern/pat-type-err-let-stmt.rs
new file mode 100644
index 000000000..6e9850b65
--- /dev/null
+++ b/src/test/ui/pattern/pat-type-err-let-stmt.rs
@@ -0,0 +1,16 @@
+// Test the `.span_label` to the type / scrutinee
+// when there's a type error in checking a pattern.
+
+fn main() {
+ // We want to point at the `Option<u8>`.
+ let Ok(0): Option<u8> = 42u8;
+ //~^ ERROR mismatched types
+ //~| ERROR mismatched types
+
+ // We want to point at the `Option<u8>`.
+ let Ok(0): Option<u8>;
+ //~^ ERROR mismatched types
+
+ // We want to point at the scrutinee.
+ let Ok(0) = 42u8; //~ ERROR mismatched types
+}