about summary refs log tree commit diff
path: root/src/test/run-fail
diff options
context:
space:
mode:
authorShotaro Yamada <sinkuu@sinkuu.xyz>2018-04-05 22:50:48 +0900
committerShotaro Yamada <sinkuu@sinkuu.xyz>2018-04-06 00:39:36 +0900
commitdc9128fff85bdb04d6bef7b655d6d95f4a5abfb0 (patch)
tree26aef6bb4ef39c357b8eb524af07e339178eba59 /src/test/run-fail
parentc75d5e242fa5c745a89e5d9541e3cc737d269061 (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.rs21
-rw-r--r--src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs15
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")
+}