From 7948afdc53cabf9330662ec894bf668839880a3c Mon Sep 17 00:00:00 2001 From: Brad Gibson Date: Sun, 11 Feb 2018 16:38:26 -0800 Subject: changed termination_trait's bound from Error to Debug; added compiletest header command and appropriate tests --- src/test/compile-fail/main-wrong-type-2.rs | 15 --------------- .../termination-trait-main-wrong-type.rs | 15 +++++++++++++++ .../termination-trait-not-satisfied.rs | 17 +++++++++++++++++ .../compile-fail/termination-trait-not-satisfied.rs | 17 ----------------- .../termination-trait-for-result-box-error_err.rs | 20 ++++++++++++++++++++ .../termination-trait-for-empty.rs | 13 +++++++++++++ .../termination-trait-for-i32.rs | 15 +++++++++++++++ .../termination-trait-for-result-box-error_ok.rs | 17 +++++++++++++++++ .../termination-trait-for-result.rs | 17 +++++++++++++++++ src/test/run-pass/termination-trait-for-empty.rs | 13 ------------- src/test/run-pass/termination-trait-for-i32.rs | 15 --------------- .../termination-trait-for-result-box-error_ok.rs | 17 +++++++++++++++++ src/test/run-pass/termination-trait-for-result.rs | 17 ----------------- 13 files changed, 131 insertions(+), 77 deletions(-) delete mode 100644 src/test/compile-fail/main-wrong-type-2.rs create mode 100644 src/test/compile-fail/rfc-1937-termination-trait/termination-trait-main-wrong-type.rs create mode 100644 src/test/compile-fail/rfc-1937-termination-trait/termination-trait-not-satisfied.rs delete mode 100644 src/test/compile-fail/termination-trait-not-satisfied.rs create mode 100644 src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs create mode 100644 src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-empty.rs create mode 100644 src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-i32.rs create mode 100644 src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs create mode 100644 src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-result.rs delete mode 100644 src/test/run-pass/termination-trait-for-empty.rs delete mode 100644 src/test/run-pass/termination-trait-for-i32.rs create mode 100644 src/test/run-pass/termination-trait-for-result-box-error_ok.rs delete mode 100644 src/test/run-pass/termination-trait-for-result.rs (limited to 'src/test') diff --git a/src/test/compile-fail/main-wrong-type-2.rs b/src/test/compile-fail/main-wrong-type-2.rs deleted file mode 100644 index a63162cf73d..00000000000 --- a/src/test/compile-fail/main-wrong-type-2.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -#![feature(termination_trait)] - -fn main() -> char { -//~^ ERROR: the trait bound `char: std::Termination` is not satisfied - ' ' -} diff --git a/src/test/compile-fail/rfc-1937-termination-trait/termination-trait-main-wrong-type.rs b/src/test/compile-fail/rfc-1937-termination-trait/termination-trait-main-wrong-type.rs new file mode 100644 index 00000000000..a63162cf73d --- /dev/null +++ b/src/test/compile-fail/rfc-1937-termination-trait/termination-trait-main-wrong-type.rs @@ -0,0 +1,15 @@ +// Copyright 2012 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![feature(termination_trait)] + +fn main() -> char { +//~^ ERROR: the trait bound `char: std::Termination` is not satisfied + ' ' +} diff --git a/src/test/compile-fail/rfc-1937-termination-trait/termination-trait-not-satisfied.rs b/src/test/compile-fail/rfc-1937-termination-trait/termination-trait-not-satisfied.rs new file mode 100644 index 00000000000..788c38c55be --- /dev/null +++ b/src/test/compile-fail/rfc-1937-termination-trait/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 or the MIT license +// , 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 {} +} diff --git a/src/test/compile-fail/termination-trait-not-satisfied.rs b/src/test/compile-fail/termination-trait-not-satisfied.rs deleted file mode 100644 index 788c38c55be..00000000000 --- a/src/test/compile-fail/termination-trait-not-satisfied.rs +++ /dev/null @@ -1,17 +0,0 @@ -// 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 or the MIT license -// , 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 {} -} diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs new file mode 100644 index 00000000000..8ce27c0a062 --- /dev/null +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs @@ -0,0 +1,20 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// must-compile-successfully +// failure-status: 1 + +#![feature(termination_trait)] + +use std::io::{Error, ErrorKind}; + +fn main() -> Result<(), Box> { + Err(Box::new(Error::new(ErrorKind::Other, "returned Box from main()"))) +} diff --git a/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-empty.rs b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-empty.rs new file mode 100644 index 00000000000..5e534da0128 --- /dev/null +++ b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-empty.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +fn main() {} diff --git a/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-i32.rs b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-i32.rs new file mode 100644 index 00000000000..fa7cb023b44 --- /dev/null +++ b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-i32.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +fn main() -> i32 { + 0 +} diff --git a/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs new file mode 100644 index 00000000000..269ac451cf4 --- /dev/null +++ b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +use std::io::Error; + +fn main() -> Result<(), Box> { + Ok(()) +} diff --git a/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-result.rs b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-result.rs new file mode 100644 index 00000000000..751db0fb500 --- /dev/null +++ b/src/test/run-pass/rfc-1937-termination-trait/termination-trait-for-result.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +use std::io::Error; + +fn main() -> Result<(), Error> { + Ok(()) +} diff --git a/src/test/run-pass/termination-trait-for-empty.rs b/src/test/run-pass/termination-trait-for-empty.rs deleted file mode 100644 index 5e534da0128..00000000000 --- a/src/test/run-pass/termination-trait-for-empty.rs +++ /dev/null @@ -1,13 +0,0 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(termination_trait)] - -fn main() {} diff --git a/src/test/run-pass/termination-trait-for-i32.rs b/src/test/run-pass/termination-trait-for-i32.rs deleted file mode 100644 index fa7cb023b44..00000000000 --- a/src/test/run-pass/termination-trait-for-i32.rs +++ /dev/null @@ -1,15 +0,0 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(termination_trait)] - -fn main() -> i32 { - 0 -} diff --git a/src/test/run-pass/termination-trait-for-result-box-error_ok.rs b/src/test/run-pass/termination-trait-for-result-box-error_ok.rs new file mode 100644 index 00000000000..269ac451cf4 --- /dev/null +++ b/src/test/run-pass/termination-trait-for-result-box-error_ok.rs @@ -0,0 +1,17 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +use std::io::Error; + +fn main() -> Result<(), Box> { + Ok(()) +} diff --git a/src/test/run-pass/termination-trait-for-result.rs b/src/test/run-pass/termination-trait-for-result.rs deleted file mode 100644 index 751db0fb500..00000000000 --- a/src/test/run-pass/termination-trait-for-result.rs +++ /dev/null @@ -1,17 +0,0 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(termination_trait)] - -use std::io::Error; - -fn main() -> Result<(), Error> { - Ok(()) -} -- cgit 1.4.1-3-g733a5