diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-05-29 10:03:40 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-05-29 10:04:08 +0000 |
| commit | a34c26e7ecfbfe3f4fd5fbd4868a0cba5676e6a5 (patch) | |
| tree | ed274505213e5fb6ed3320bd9a5213dd9fca4616 /tests | |
| parent | ceb45d55190eb00d30b8762bc4c34cf71c53b637 (diff) | |
| download | rust-a34c26e7ecfbfe3f4fd5fbd4868a0cba5676e6a5.tar.gz rust-a34c26e7ecfbfe3f4fd5fbd4868a0cba5676e6a5.zip | |
Make `body_owned_by` return the body directly.
Almost all callers want this anyway, and now we can use it to also return fed bodies
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/inline-const/uninit_local.rs | 6 | ||||
| -rw-r--r-- | tests/ui/inline-const/uninit_local.stderr | 16 |
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`. |
