/// extracting those success or failure values from an existing instance and
/// creating a new instance from a success or failure value.
#[unstable(feature = "try_trait", issue = "42327")]
-#[cfg_attr(
- not(bootstrap),
- rustc_on_unimplemented(
- on(
- all(
- any(from_method = "from_error", from_method = "from_ok"),
- from_desugaring = "QuestionMark"
- ),
- message = "the `?` operator can only be used in {ItemContext} \
- that returns `Result` or `Option` \
- (or another type that implements `{Try}`)",
- label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
- enclosing_scope = "this function should return `Result` or `Option` to accept `?`"
+#[rustc_on_unimplemented(
+ on(
+ all(
+ any(from_method = "from_error", from_method = "from_ok"),
+ from_desugaring = "QuestionMark"
),
- on(
- all(from_method = "into_result", from_desugaring = "QuestionMark"),
- message = "the `?` operator can only be applied to values \
- that implement `{Try}`",
- label = "the `?` operator cannot be applied to type `{Self}`"
- )
+ message = "the `?` operator can only be used in {ItemContext} \
+ that returns `Result` or `Option` \
+ (or another type that implements `{Try}`)",
+ label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
+ enclosing_scope = "this function should return `Result` or `Option` to accept `?`"
+ ),
+ on(
+ all(from_method = "into_result", from_desugaring = "QuestionMark"),
+ message = "the `?` operator can only be applied to values \
+ that implement `{Try}`",
+ label = "the `?` operator cannot be applied to type `{Self}`"
)
)]
#[doc(alias = "?")]