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 :)
This commit is contained in:
commit
bfbb1f5ce1
53 changed files with 575 additions and 113 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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
|
||||
' '
|
||||
}
|
||||
|
|
|
|||
17
src/test/compile-fail/termination-trait-not-satisfied.rs
Normal file
17
src/test/compile-fail/termination-trait-not-satisfied.rs
Normal file
|
|
@ -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 {}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue