]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/std-impl-gate.rs
Move `{core,std}::stream::Stream` to `{core,std}::async_iter::AsyncIterator`.
[rust.git] / src / test / 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 calls in constant functions are limited
15 }
16
17 fn main() {
18     const VAL: Vec<usize> = const_context();
19
20     assert_eq!(VAL, non_const_context());
21 }