1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
12 struct MyError(()); // doesn't implement Debug
15 struct MyErrorWithParam<T> {
20 let res: Result<i32, ()> = Ok(0);
23 res.ok().expect("disaster!");
24 // the following should not warn, since `expect` isn't implemented unless
25 // the error type implements `Debug`
26 let res2: Result<i32, MyError> = Ok(0);
27 res2.ok().expect("oh noes!");
28 let res3: Result<u32, MyErrorWithParam<u8>> = Ok(0);
29 res3.ok().expect("whoof");
30 let res4: Result<u32, io::Error> = Ok(0);
31 res4.ok().expect("argh");
32 let res5: io::Result<u32> = Ok(0);
33 res5.ok().expect("oops");
34 let res6: Result<u32, &str> = Ok(0);
35 res6.ok().expect("meh");