rust/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs

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

31 lines
794 B
Rust
Raw Normal View History

#![allow(incomplete_features)]
2024-10-30 13:03:44 -05:00
#![feature(const_trait_impl, try_trait_v2, const_try)]
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?;
//~^ ERROR `?` cannot determine the branch of `TryMe` in constant functions
//~| ERROR `?` cannot convert from residual of `TryMe` in constant functions
TryMe
}
const _: () = {
t();
};
fn main() {}