diff options
| author | Shotaro Yamada <sinkuu@sinkuu.xyz> | 2018-04-05 22:50:48 +0900 |
|---|---|---|
| committer | Shotaro Yamada <sinkuu@sinkuu.xyz> | 2018-04-06 00:39:36 +0900 |
| commit | dc9128fff85bdb04d6bef7b655d6d95f4a5abfb0 (patch) | |
| tree | 26aef6bb4ef39c357b8eb524af07e339178eba59 /src/test/run-fail | |
| parent | c75d5e242fa5c745a89e5d9541e3cc737d269061 (diff) | |
Fix ICE with `main`'s return type containing lifetimes
Diffstat (limited to 'src/test/run-fail')
| -rw-r--r-- | src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs | 21 | ||||
| -rw-r--r-- | src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs | 15 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs new file mode 100644 index 00000000000..bd6bcf88a0c --- /dev/null +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs @@ -0,0 +1,21 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// must-compile-successfully +// failure-status: 1 + +#![feature(dyn_trait)] + +use std::error::Error; +use std::io; + +fn main() -> Result<(), Box<dyn Error>> { + Err(Box::new(io::Error::new(io::ErrorKind::Other, "returned Box<dyn Error> from main()"))) +} diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs new file mode 100644 index 00000000000..d2828812e9f --- /dev/null +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs @@ -0,0 +1,15 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: An error message for you + +fn main() -> Result<(), &'static str> { + Err("An error message for you") +} |
