summaryrefslogtreecommitdiffstats
path: root/src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs b/src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs
new file mode 100644
index 000000000..305be9221
--- /dev/null
+++ b/src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs
@@ -0,0 +1,13 @@
+// check-pass
+
+#![feature(let_else)]
+
+fn main() {
+ let Some(n) = &mut &mut Some(5i32) else { return; };
+ *n += 1; // OK
+ let _ = n;
+
+ let Some(n): &mut Option<i32> = &mut &mut Some(5i32) else { return; };
+ *n += 1; // OK
+ let _ = n;
+}