Skip to content

Files

Latest commit

03bbe9d · Jul 16, 2020

History

History
28 lines (19 loc) · 401 Bytes

File metadata and controls

28 lines (19 loc) · 401 Bytes

An unstable feature in const contexts was used.

Erroneous code example:

trait T {}

impl T for () {}

const fn foo() -> impl T { // error: `impl Trait` in const fn is unstable
    ()
}

To enable this feature on a nightly version of rustc, add the const_fn feature flag:

#![feature(const_fn)]

trait T {}

impl T for () {}

const fn foo() -> impl T {
    ()
}