diff options
| author | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-08-31 00:12:34 +0300 |
|---|---|---|
| committer | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-09-03 13:10:54 +0300 |
| commit | 02b3ae63e2d3fd2fe7496eaa8b6862322aaf38b3 (patch) | |
| tree | 6e1a3525e66f0c7a6da07c26769bcda7d0eaf4d1 /src/libcore/ops | |
| parent | 6866aea5af0cebe3c3a942585e36c9033e1122ef (diff) | |
| download | rust-02b3ae63e2d3fd2fe7496eaa8b6862322aaf38b3.tar.gz rust-02b3ae63e2d3fd2fe7496eaa8b6862322aaf38b3.zip | |
enable desugaring-sensitive error messages and use them in Try
Maybe I should allow error messages to check the *specific* desugaring? Thanks @huntiep for the idea!
Diffstat (limited to 'src/libcore/ops')
| -rw-r--r-- | src/libcore/ops/try.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libcore/ops/try.rs b/src/libcore/ops/try.rs index 78326c3e639..694d5b8296f 100644 --- a/src/libcore/ops/try.rs +++ b/src/libcore/ops/try.rs @@ -15,8 +15,16 @@ /// 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")] -#[rustc_on_unimplemented = "the `?` operator can only be used in a function that returns `Result` \ - (or another type that implements `{Try}`)"] +#[cfg_attr(stage0, + rustc_on_unimplemented = "the `?` operator can only be used in a \ + function that returns `Result` \ + (or another type that implements `{Try}`)")] +#[cfg_attr(not(stage0), + rustc_on_unimplemented( + on(all(direct, from_desugaring), + message="the `?` operator can only be used in a \ + function that returns `Result` \ + (or another type that implements `{Try}`)")))] pub trait Try { /// The type of this value when viewed as successful. #[unstable(feature = "try_trait", issue = "42327")] |
