about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2017-08-31 21:46:03 +0300
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2017-09-03 13:10:54 +0300
commitefa09ea554575cd0b4ce01ada44fce730c0f7ac4 (patch)
tree896816568ac690f302bad2440a353a0f13eb91ad /src/libcore
parent6dec953c5ad7357a9f2d90626e56bc0dc30127a9 (diff)
downloadrust-efa09ea554575cd0b4ce01ada44fce730c0f7ac4.tar.gz
rust-efa09ea554575cd0b4ce01ada44fce730c0f7ac4.zip
on_unimplemented: add method-name checks and use them in Try
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ops/try.rs4
1 files changed, 3 insertions, 1 deletions
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}`)",