2024-06-25 10:44:00 +00:00
|
|
|
#![allow(incomplete_features)]
|
2024-10-30 18:03:44 +00:00
|
|
|
#![feature(const_trait_impl, try_trait_v2, const_try)]
|
2024-06-25 10:44:00 +00:00
|
|
|
use std::ops::{FromResidual, Try};
|
|
|
|
|
|
|
|
|
|
struct TryMe;
|
|
|
|
|
struct Error;
|
|
|
|
|
|
|
|
|
|
impl const FromResidual<Error> for TryMe {}
|
|
|
|
|
//~^ ERROR const `impl` for trait `FromResidual` which is not marked with `#[const_trait]`
|
|
|
|
|
//~| ERROR not all trait items implemented
|
|
|
|
|
|
|
|
|
|
impl const Try for TryMe {
|
|
|
|
|
//~^ ERROR const `impl` for trait `Try` which is not marked with `#[const_trait]`
|
|
|
|
|
//~| ERROR not all trait items implemented
|
|
|
|
|
type Output = ();
|
|
|
|
|
type Residual = Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fn t() -> TryMe {
|
|
|
|
|
TryMe?;
|
2024-11-22 02:31:42 +00:00
|
|
|
//~^ ERROR `?` is not allowed on
|
|
|
|
|
//~| ERROR `?` is not allowed on
|
2024-06-25 10:44:00 +00:00
|
|
|
TryMe
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const _: () = {
|
|
|
|
|
t();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
fn main() {}
|