]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/rfc-2203-const-array-repeat-exprs/const-fns.rs
68a9227dea96ed4dd22549b440f5271099744495
[rust.git] / src / test / ui / consts / rfc-2203-const-array-repeat-exprs / const-fns.rs
1 // ignore-tidy-linelength
2 // ignore-compare-mode-nll
3 #![feature(const_in_array_repeat_expressions, nll)]
4 #![allow(warnings)]
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 fn no_copy() {
18     const ARR: [Option<Bar>; 2] = [type_no_copy(); 2];
19     //~^ ERROR the trait bound `std::option::Option<Bar>: std::marker::Copy` is not satisfied [E0277]
20 }
21
22 fn copy() {
23     const ARR: [u32; 2] = [type_copy(); 2];
24 }
25
26 fn main() {}