about summary refs log tree commit diff
path: root/src/test/ui/suggestions
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2017-08-31 00:12:34 +0300
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2017-09-03 13:10:54 +0300
commit02b3ae63e2d3fd2fe7496eaa8b6862322aaf38b3 (patch)
tree6e1a3525e66f0c7a6da07c26769bcda7d0eaf4d1 /src/test/ui/suggestions
parent6866aea5af0cebe3c3a942585e36c9033e1122ef (diff)
downloadrust-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/test/ui/suggestions')
-rw-r--r--src/test/ui/suggestions/try-operator-on-main.rs6
-rw-r--r--src/test/ui/suggestions/try-operator-on-main.stderr35
2 files changed, 35 insertions, 6 deletions
diff --git a/src/test/ui/suggestions/try-operator-on-main.rs b/src/test/ui/suggestions/try-operator-on-main.rs
index 55154e3507e..c6b4c091901 100644
--- a/src/test/ui/suggestions/try-operator-on-main.rs
+++ b/src/test/ui/suggestions/try-operator-on-main.rs
@@ -8,6 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::ops::Try;
+
 fn main() {
     std::fs::File::open("foo")?;
+
+    try_trait_generic::<()>();
 }
+
+fn try_trait_generic<T: Try>() {}
diff --git a/src/test/ui/suggestions/try-operator-on-main.stderr b/src/test/ui/suggestions/try-operator-on-main.stderr
index cf0481bdab7..66bd77bb690 100644
--- a/src/test/ui/suggestions/try-operator-on-main.stderr
+++ b/src/test/ui/suggestions/try-operator-on-main.stderr
@@ -1,14 +1,37 @@
-error[E0277]: the trait bound `(): std::ops::Try` is not satisfied
-  --> $DIR/try-operator-on-main.rs:12:5
+error: use of unstable library feature 'try_trait' (see issue #42327)
+  --> $DIR/try-operator-on-main.rs:11:5
+   |
+11 | use std::ops::Try;
+   |     ^^^^^^^^^^^^^
+   |
+   = help: add #![feature(try_trait)] to the crate attributes to enable
+
+error: use of unstable library feature 'try_trait' (see issue #42327)
+  --> $DIR/try-operator-on-main.rs:19:25
+   |
+19 | fn try_trait_generic<T: Try>() {}
+   |                         ^^^
    |
-12 |     std::fs::File::open("foo")?;
+   = help: add #![feature(try_trait)] to the crate attributes to enable
+
+error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
+  --> $DIR/try-operator-on-main.rs:14:5
+   |
+14 |     std::fs::File::open("foo")?;
    |     ---------------------------
    |     |
-   |     the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
+   |     the trait `std::ops::Try` is not implemented for `()`
    |     in this macro invocation
    |
-   = help: the trait `std::ops::Try` is not implemented for `()`
    = note: required by `std::ops::Try::from_error`
 
-error: aborting due to previous error
+error[E0277]: the trait bound `(): std::ops::Try` is not satisfied
+  --> $DIR/try-operator-on-main.rs:16:5
+   |
+16 |     try_trait_generic::<()>();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()`
+   |
+   = note: required by `try_trait_generic`
+
+error: aborting due to 4 previous errors