]> git.proxmox.com Git - rustc.git/blob - src/test/ui/feature-gates/feature-gate-const_in_array_repeat_expressions.rs
New upstream version 1.40.0+dfsg1
[rustc.git] / src / test / ui / feature-gates / feature-gate-const_in_array_repeat_expressions.rs
1 // ignore-tidy-linelength
2 #![allow(warnings)]
3
4 struct Bar;
5
6 // This function would compile with the feature gate, and tests that it is suggested.
7 fn foo() {
8 let arr: [Option<String>; 2] = [None::<String>; 2];
9 //~^ ERROR the trait bound `std::option::Option<std::string::String>: std::marker::Copy` is not satisfied [E0277]
10 }
11
12 // This function would not compile with the feature gate, and tests that it is not suggested.
13 fn bar() {
14 let arr: [Option<String>; 2] = [Some("foo".to_string()); 2];
15 //~^ ERROR the trait bound `std::option::Option<std::string::String>: std::marker::Copy` is not satisfied [E0277]
16 }
17
18 fn main() {}