]>
Commit | Line | Data |
---|---|---|
2c00a5a8 XL |
1 | // ignore-cloudabi no std::fs support |
2 | ||
ea8adc8c XL |
3 | #![feature(try_trait)] |
4 | ||
5 | use std::ops::Try; | |
6 | ||
7453a54e | 7 | fn main() { |
ea8adc8c | 8 | // error for a `Try` type on a non-`Try` fn |
ff7c6d11 | 9 | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only |
ea8adc8c XL |
10 | |
11 | // a non-`Try` type on a non-`Try` fn | |
ff7c6d11 | 12 | ()?; //~ ERROR the `?` operator can only |
ea8adc8c XL |
13 | |
14 | // an unrelated use of `Try` | |
ff7c6d11 | 15 | try_trait_generic::<()>(); //~ ERROR the trait bound |
ea8adc8c XL |
16 | } |
17 | ||
18 | ||
19 | ||
20 | fn try_trait_generic<T: Try>() -> T { | |
21 | // and a non-`Try` object on a `Try` fn. | |
e1599b0c | 22 | ()?; //~ ERROR the `?` operator can only be applied to values that implement `std::ops::Try` |
ea8adc8c XL |
23 | |
24 | loop {} | |
223e47cc | 25 | } |