-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relax termination_trait's error bound #47544
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <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(termination_trait)] | ||
|
||
use std::io::{Error, ErrorKind}; | ||
|
||
fn main() -> Result<(), Box<Error>> { | ||
Err(Box::new(Error::new(ErrorKind::Other, "returned Box<Error> from main()"))) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <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)] | ||
|
||
use std::io::Error; | ||
|
||
fn main() -> Result<(), Box<Error>> { | ||
Ok(()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <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)] | ||
|
||
use std::io::Error; | ||
|
||
fn main() -> Result<(), Box<Error>> { | ||
Ok(()) | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -295,11 +295,14 @@ impl<'test> TestCx<'test> { | |||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
fn check_correct_failure_status(&self, proc_res: &ProcRes) { | ||||||||||||||||
// The value the rust runtime returns on failure | ||||||||||||||||
const RUST_ERR: i32 = 101; | ||||||||||||||||
if proc_res.status.code() != Some(RUST_ERR) { | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this looks suspicious. Can you instead make the I feel like I'd like to keep testing that most of the run-fail examples return 101. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nikomatsakis where can I ping you? (I'm on IRC as U007D) I'm interested in learning how to create a header command. (Or if there's a pointer to a doc somewhere, I'd be grateful for a pointer). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can ping me on IRC or gitter. There's no docs really but creating a header command is pretty straightforward. You would add a field to this struct: rust/src/tools/compiletest/src/header.rs Lines 181 to 182 in 3bcda48
and modify this function to initialize it: rust/src/tools/compiletest/src/header.rs Lines 290 to 293 in 3bcda48
then in this code: rust/src/tools/compiletest/src/runtest.rs Line 297 in 3bcda48
you can just read There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to be a good citizen, you can consider contributing back to rustc-guide when you're done with some tips =) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. haha--deal! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "what I learned" contributed back to rustc-guide rust-lang/rustc-dev-guide#53. |
||||||||||||||||
let expected_status = Some(self.props.failure_status); | ||||||||||||||||
let received_status = proc_res.status.code(); | ||||||||||||||||
|
||||||||||||||||
if expected_status != received_status { | ||||||||||||||||
self.fatal_proc_rec( | ||||||||||||||||
&format!("failure produced the wrong error: {}", proc_res.status), | ||||||||||||||||
&format!("Error: expected failure status ({:?}) but received status {:?}.", | ||||||||||||||||
expected_status, | ||||||||||||||||
received_status), | ||||||||||||||||
proc_res, | ||||||||||||||||
); | ||||||||||||||||
} | ||||||||||||||||
|
@@ -320,7 +323,6 @@ impl<'test> TestCx<'test> { | |||||||||||||||
); | ||||||||||||||||
|
||||||||||||||||
let proc_res = self.exec_compiled_test(); | ||||||||||||||||
|
||||||||||||||||
if !proc_res.status.success() { | ||||||||||||||||
self.fatal_proc_rec("test run failed!", &proc_res); | ||||||||||||||||
} | ||||||||||||||||
|
@@ -499,7 +501,6 @@ impl<'test> TestCx<'test> { | |||||||||||||||
expected, | ||||||||||||||||
actual | ||||||||||||||||
); | ||||||||||||||||
panic!(); | ||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, pre-existing, but I would like it if we moved these tests (and the existing ones) into a directory, maybe something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes; can do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
termination_trait
tests reorganized as per above.