From efa09ea554575cd0b4ce01ada44fce730c0f7ac4 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Thu, 31 Aug 2017 21:46:03 +0300 Subject: on_unimplemented: add method-name checks and use them in Try --- src/libcore/ops/try.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/libcore/ops') diff --git a/src/libcore/ops/try.rs b/src/libcore/ops/try.rs index 6e330f538a8..28e84d2fba6 100644 --- a/src/libcore/ops/try.rs +++ b/src/libcore/ops/try.rs @@ -21,7 +21,9 @@ (or another type that implements `{Try}`)")] #[cfg_attr(not(stage0), rustc_on_unimplemented( - on(all(direct, from_desugaring="?"), + on(all( + any(from_method="from_error", from_method="from_ok"), + from_desugaring="?"), message="the `?` operator can only be used in a \ function that returns `Result` \ (or another type that implements `{Try}`)", -- cgit 1.4.1-3-g733a5