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