// ignore-compile-mode-nll #![allow(warnings)] #![feature(constants_in_array_repeat_expressions, nll)] // Some type that is not copyable. struct Bar; mod constants { use Bar; fn no_impl_copy_empty_value_no_elements() { const FOO: Option = None; const ARR: [Option; 0] = [FOO; 0]; } fn no_impl_copy_empty_value_single_element() { const FOO: Option = None; const ARR: [Option; 1] = [FOO; 1]; } fn no_impl_copy_empty_value_multiple_elements() { const FOO: Option = None; const ARR: [Option; 2] = [FOO; 2]; } fn no_impl_copy_value_no_elements() { const FOO: Option = Some(Bar); const ARR: [Option; 0] = [FOO; 0]; } fn no_impl_copy_value_single_element() { const FOO: Option = Some(Bar); const ARR: [Option; 1] = [FOO; 1]; } fn no_impl_copy_value_multiple_elements() { const FOO: Option = Some(Bar); const ARR: [Option; 2] = [FOO; 2]; } fn impl_copy_empty_value_no_elements() { const FOO: Option = None; const ARR: [Option; 0] = [FOO; 0]; } fn impl_copy_empty_value_one_element() { const FOO: Option = None; const ARR: [Option; 1] = [FOO; 1]; } fn impl_copy_empty_value_multiple_elements() { const FOO: Option = None; const ARR: [Option; 2] = [FOO; 2]; } fn impl_copy_value_no_elements() { const FOO: Option = Some(4); const ARR: [Option; 0] = [FOO; 0]; } fn impl_copy_value_one_element() { const FOO: Option = Some(4); const ARR: [Option; 1] = [FOO; 1]; } fn impl_copy_value_multiple_elements() { const FOO: Option = Some(4); const ARR: [Option; 2] = [FOO; 2]; } } mod non_constants { use Bar; fn no_impl_copy_empty_value_no_elements() { let x = None; let arr: [Option; 0] = [x; 0]; } fn no_impl_copy_empty_value_single_element() { let x = None; let arr: [Option; 1] = [x; 1]; } fn no_impl_copy_empty_value_multiple_elements() { let x = None; let arr: [Option; 2] = [x; 2]; //~^ ERROR the trait bound `std::option::Option: std::marker::Copy` is not satisfied [E0277] } fn no_impl_copy_value_no_elements() { let x = Some(Bar); let arr: [Option; 0] = [x; 0]; } fn no_impl_copy_value_single_element() { let x = Some(Bar); let arr: [Option; 1] = [x; 1]; } fn no_impl_copy_value_multiple_elements() { let x = Some(Bar); let arr: [Option; 2] = [x; 2]; //~^ ERROR the trait bound `std::option::Option: std::marker::Copy` is not satisfied [E0277] } fn impl_copy_empty_value_no_elements() { let x: Option = None; let arr: [Option; 0] = [x; 0]; } fn impl_copy_empty_value_one_element() { let x: Option = None; let arr: [Option; 1] = [x; 1]; } fn impl_copy_empty_value_multiple_elements() { let x: Option = None; let arr: [Option; 2] = [x; 2]; } fn impl_copy_value_no_elements() { let x: Option = Some(4); let arr: [Option; 0] = [x; 0]; } fn impl_copy_value_one_element() { let x: Option = Some(4); let arr: [Option; 1] = [x; 1]; } fn impl_copy_value_multiple_elements() { let x: Option = Some(4); let arr: [Option; 2] = [x; 2]; } } fn main() {}