3 #![feature(staged_api)]
4 #![feature(const_trait_impl)]
5 #![feature(const_t_try)]
7 #![feature(try_trait_v2)]
9 #![stable(feature = "foo", since = "1.0")]
11 use std::ops::{ControlFlow, FromResidual, Try};
13 #[stable(feature = "foo", since = "1.0")]
16 #[stable(feature = "foo", since = "1.0")]
17 #[rustc_const_unstable(feature = "const_t_try", issue = "none")]
18 impl const Try for T {
22 fn from_output(t: T) -> T {
26 fn branch(self) -> ControlFlow<T, T> {
27 ControlFlow::Continue(self)
31 #[stable(feature = "foo", since = "1.0")]
32 #[rustc_const_unstable(feature = "const_t_try", issue = "none")]
33 impl const FromResidual for T {
34 fn from_residual(t: T) -> T {
39 #[stable(feature = "foo", since = "1.0")]
42 #[stable(feature = "foo", since = "1.0")]
46 // Must enable unstable features to call this trait fn in const contexts.