rust/tests/ui/rfcs/rfc-2632-const-trait-impl/hir-const-check.rs

18 lines
301 B
Rust
Raw Normal View History

2020-03-02 12:53:58 -06:00
// Regression test for #69615.
#![feature(const_trait_impl)]
2020-03-02 12:53:58 -06:00
2022-08-28 01:27:31 -05:00
#[const_trait]
2020-03-02 12:53:58 -06:00
pub trait MyTrait {
2020-06-25 19:43:48 -05:00
fn method(&self) -> Option<()>;
2020-03-02 12:53:58 -06:00
}
impl const MyTrait for () {
2020-06-25 19:43:48 -05:00
fn method(&self) -> Option<()> {
Some(())?; //~ ERROR `?` is not allowed in a `const fn`
None
2020-03-02 12:53:58 -06:00
}
}
fn main() {}