about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-12-27 15:41:51 +0000
committerbors <bors@rust-lang.org>2017-12-27 15:41:51 +0000
commitbfbb1f5ce1e6a85a03219767cfc5c9bab3f7bf9e (patch)
treeb72634f6bee5eb0e51d428fe53ecd1c28c11b907 /src/test/compile-fail
parent63efff5a71269ae22b8769e2e6f9aaa2f940f823 (diff)
parent09f94bea4aca7696b58dd7e6668ca27d71908984 (diff)
downloadrust-bfbb1f5ce1e6a85a03219767cfc5c9bab3f7bf9e.tar.gz
rust-bfbb1f5ce1e6a85a03219767cfc5c9bab3f7bf9e.zip
Auto merge of #46479 - bkchr:termination_trait, r=arielb1
Implements RFC 1937: `?` in `main`

This is the first part of the RFC 1937 that supports new
`Termination` trait in the rust `main` function.

Thanks @nikomatsakis, @arielb1 and all other people in the gitter channel for all your help!

The support for doctest and `#[test]` is still missing, bu as @nikomatsakis said, smaller pull requests are better :)
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/feature-gate-termination_trait.rs (renamed from src/test/compile-fail/E0580.rs)6
-rw-r--r--src/test/compile-fail/main-wrong-type-2.rs3
-rw-r--r--src/test/compile-fail/termination-trait-not-satisfied.rs17
3 files changed, 23 insertions, 3 deletions
diff --git a/src/test/compile-fail/E0580.rs b/src/test/compile-fail/feature-gate-termination_trait.rs
index a2ef7da78a8..5a56445b64e 100644
--- a/src/test/compile-fail/E0580.rs
+++ b/src/test/compile-fail/feature-gate-termination_trait.rs
@@ -1,4 +1,4 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,4 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn main() -> i32 { 0 } //~ ERROR E0580
+fn main() -> i32 { //~ ERROR main function has wrong type [E0580]
+    0
+}
diff --git a/src/test/compile-fail/main-wrong-type-2.rs b/src/test/compile-fail/main-wrong-type-2.rs
index 9d74d1a9049..a63162cf73d 100644
--- a/src/test/compile-fail/main-wrong-type-2.rs
+++ b/src/test/compile-fail/main-wrong-type-2.rs
@@ -7,8 +7,9 @@
 // <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.
+#![feature(termination_trait)]
 
 fn main() -> char {
-//~^ ERROR: main function has wrong type [E0580]
+//~^ ERROR: the trait bound `char: std::Termination` is not satisfied
     ' '
 }
diff --git a/src/test/compile-fail/termination-trait-not-satisfied.rs b/src/test/compile-fail/termination-trait-not-satisfied.rs
new file mode 100644
index 00000000000..788c38c55be
--- /dev/null
+++ b/src/test/compile-fail/termination-trait-not-satisfied.rs
@@ -0,0 +1,17 @@
+// Copyright 2017 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.
+
+#![feature(termination_trait)]
+
+struct ReturnType {}
+
+fn main() -> ReturnType { //~ ERROR `ReturnType: std::Termination` is not satisfied
+    ReturnType {}
+}