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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
301 B
Rust
Raw Normal View History

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