]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/rfc-2203-const-array-repeat-exprs/fn-call-in-const.rs
Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup
[rust.git] / src / test / ui / consts / rfc-2203-const-array-repeat-exprs / fn-call-in-const.rs
1 // run-pass
2
3 #![allow(unused)]
4 #![feature(const_in_array_repeat_expressions)]
5
6 // Some type that is not copyable.
7 struct Bar;
8
9 const fn type_no_copy() -> Option<Bar> {
10     None
11 }
12
13 const fn type_copy() -> u32 {
14     3
15 }
16
17 const _: [u32; 2] = [type_copy(); 2];
18
19 // This is allowed because all promotion contexts use the explicit rules for promotability when
20 // inside an explicit const context.
21 const _: [Option<Bar>; 2] = [type_no_copy(); 2];
22
23 fn main() {}