]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfc-2632-const-trait-impl/std-impl-gate.rs
Rollup merge of #106754 - compiler-errors:ty-infer-method-is-confusing, r=lcnr
[rust.git] / tests / ui / rfc-2632-const-trait-impl / std-impl-gate.rs
1 // This tests feature gates for const impls in the standard library.
2
3 // revisions: stock gated
4 //[gated] run-pass
5
6 #![cfg_attr(gated, feature(const_trait_impl, const_default_impls))]
7
8 fn non_const_context() -> Vec<usize> {
9     Default::default()
10 }
11
12 const fn const_context() -> Vec<usize> {
13     Default::default()
14     //[stock]~^ ERROR cannot call non-const fn
15 }
16
17 fn main() {
18     const VAL: Vec<usize> = const_context();
19
20     assert_eq!(VAL, non_const_context());
21 }