about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/inline-const/uninit_local.rs6
-rw-r--r--tests/ui/inline-const/uninit_local.stderr16
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/inline-const/uninit_local.rs b/tests/ui/inline-const/uninit_local.rs
new file mode 100644
index 00000000000..548c053affc
--- /dev/null
+++ b/tests/ui/inline-const/uninit_local.rs
@@ -0,0 +1,6 @@
+fn main() {
+    let _my_usize = const {
+        let x: bool;
+        while x {} //~ ERROR: `x` isn't initialized
+    };
+}
diff --git a/tests/ui/inline-const/uninit_local.stderr b/tests/ui/inline-const/uninit_local.stderr
new file mode 100644
index 00000000000..37b78e337e7
--- /dev/null
+++ b/tests/ui/inline-const/uninit_local.stderr
@@ -0,0 +1,16 @@
+error[E0381]: used binding `x` isn't initialized
+  --> $DIR/uninit_local.rs:4:15
+   |
+LL |         let x: bool;
+   |             - binding declared here but left uninitialized
+LL |         while x {}
+   |               ^ `x` used here but it isn't initialized
+   |
+help: consider assigning a value
+   |
+LL |         let x: bool = false;
+   |                     +++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0381`.