Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/ui/consts/promoted-const-tuple-variant-101363.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/101363>.
//! Borrowing the result of a block expression inside a tuple variant
//! constructor in a `const` used to fail with E0716; it is now promoted.

//@ check-pass

const OPTIONAL_SLICE_V1: Option<&'static [u8]> = Some(&{
let array = [1, 2, 3];
array
});

const OPTIONAL_SLICE_V2: Option<&'static [u8]> = Some {
0: &{
let array = [1, 2, 3];
array
},
};

fn main() {}
Loading