blob: 68a9227dea96ed4dd22549b440f5271099744495 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// ignore-tidy-linelength
// ignore-compare-mode-nll
#![feature(const_in_array_repeat_expressions, nll)]
#![allow(warnings)]
// Some type that is not copyable.
struct Bar;
const fn type_no_copy() -> Option<Bar> {
None
}
const fn type_copy() -> u32 {
3
}
fn no_copy() {
const ARR: [Option<Bar>; 2] = [type_no_copy(); 2];
//~^ ERROR the trait bound `std::option::Option<Bar>: std::marker::Copy` is not satisfied [E0277]
}
fn copy() {
const ARR: [u32; 2] = [type_copy(); 2];
}
fn main() {}
|