Open
Description
The lang team indicated that the following code should compile:
const unsafe fn test() -> usize { 42 }
fn main() { unsafe {
let x = [0; test()];
} }
However currently the array length does not "inherit" unsafety from the surrounding block.
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> src/main.rs:4:17
|
4 | let x = [0; test()];
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior