diff options
| author | bors <bors@rust-lang.org> | 2017-02-08 18:11:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-02-08 18:11:06 +0000 |
| commit | 4379e2fa08bf31125efa1a9d8bc3c85b16e2c2f3 (patch) | |
| tree | 58de9050e9127eb919f6f11cb93bd951b457b644 /src/test | |
| parent | 10f6a5c4431e09d355a0ba319a630e02a1e38361 (diff) | |
| parent | 62d22678d4a7c6a34837137073d8767166d6db1e (diff) | |
Auto merge of #39645 - frewsxcv:rollup, r=frewsxcv
Rollup of 11 pull requests - Successful merges: #39462, #39512, #39529, #39557, #39561, #39582, #39583, #39597, #39622, #39624, #39630 - Failed merges:
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/lint-ctypes.rs | 6 | ||||
| -rw-r--r-- | src/test/incremental/issue-39569.rs | 38 | ||||
| -rw-r--r-- | src/test/run-pass/issue-34798.rs | 34 | ||||
| -rw-r--r-- | src/test/run-pass/try-wait.rs | 19 | ||||
| -rw-r--r-- | src/test/rustdoc/test_option_check/bar.rs | 19 | ||||
| -rw-r--r-- | src/test/rustdoc/test_option_check/test.rs | 2 |
6 files changed, 108 insertions, 10 deletions
diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs index ccc25b58228..608b1eb0872 100644 --- a/src/test/compile-fail/lint-ctypes.rs +++ b/src/test/compile-fail/lint-ctypes.rs @@ -29,6 +29,9 @@ pub type RustBadRet = extern fn() -> Box<u32>; pub type CVoidRet = (); pub struct Foo; +#[repr(C)] +pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>); + extern { pub fn ptr_type1(size: *const Foo); //~ ERROR: found struct without pub fn ptr_type2(size: *const Foo); //~ ERROR: found struct without @@ -40,6 +43,9 @@ extern { pub fn tuple_type(p: (i32, i32)); //~ ERROR found Rust tuple type pub fn tuple_type2(p: I32Pair); //~ ERROR found Rust tuple type pub fn zero_size(p: ZeroSize); //~ ERROR found zero-size struct + pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR found zero-sized type + pub fn zero_size_phantom_toplevel() + -> ::std::marker::PhantomData<bool>; //~ ERROR: found zero-sized type pub fn fn_type(p: RustFn); //~ ERROR found function pointer with Rust pub fn fn_type2(p: fn()); //~ ERROR found function pointer with Rust pub fn fn_contained(p: RustBadRet); //~ ERROR: found struct without diff --git a/src/test/incremental/issue-39569.rs b/src/test/incremental/issue-39569.rs new file mode 100644 index 00000000000..5b53e948253 --- /dev/null +++ b/src/test/incremental/issue-39569.rs @@ -0,0 +1,38 @@ +// Copyright 2014 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. + +// Regression test for a weird corner case in our dep-graph reduction +// code. When we solve `CoerceUnsized<Foo>`, we find no impls, so we +// don't end up with an edge to any HIR nodes, but it still gets +// preserved in the dep graph. + +// revisions:rpass1 rpass2 +// compile-flags: -Z query-dep-graph + +use std::sync::Arc; + +#[cfg(rpass1)] +struct Foo { x: usize } + +#[cfg(rpass1)] +fn main() { + let x: Arc<Foo> = Arc::new(Foo { x: 22 }); + let y: Arc<Foo> = x; +} + +#[cfg(rpass2)] +struct FooX { x: usize } + +#[cfg(rpass2)] +fn main() { + let x: Arc<FooX> = Arc::new(FooX { x: 22 }); + let y: Arc<FooX> = x; +} + diff --git a/src/test/run-pass/issue-34798.rs b/src/test/run-pass/issue-34798.rs new file mode 100644 index 00000000000..e217d07ed72 --- /dev/null +++ b/src/test/run-pass/issue-34798.rs @@ -0,0 +1,34 @@ +// 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. + +#![forbid(improper_ctypes)] +#![allow(dead_code)] + +#[repr(C)] +pub struct Foo { + size: u8, + __value: ::std::marker::PhantomData<i32>, +} + +#[repr(C)] +pub struct ZeroSizeWithPhantomData<T>(::std::marker::PhantomData<T>); + +#[repr(C)] +pub struct Bar { + size: u8, + baz: ZeroSizeWithPhantomData<i32>, +} + +extern "C" { + pub fn bar(_: *mut Foo, _: *mut Bar); +} + +fn main() { +} diff --git a/src/test/run-pass/try-wait.rs b/src/test/run-pass/try-wait.rs index d9826373cce..be87b7b3c87 100644 --- a/src/test/run-pass/try-wait.rs +++ b/src/test/run-pass/try-wait.rs @@ -13,7 +13,6 @@ #![feature(process_try_wait)] use std::env; -use std::io; use std::process::Command; use std::thread; use std::time::Duration; @@ -32,17 +31,17 @@ fn main() { .arg("sleep") .spawn() .unwrap(); - let err = me.try_wait().unwrap_err(); - assert_eq!(err.kind(), io::ErrorKind::WouldBlock); - let err = me.try_wait().unwrap_err(); - assert_eq!(err.kind(), io::ErrorKind::WouldBlock); + let maybe_status = me.try_wait().unwrap(); + assert!(maybe_status.is_none()); + let maybe_status = me.try_wait().unwrap(); + assert!(maybe_status.is_none()); me.kill().unwrap(); me.wait().unwrap(); - let status = me.try_wait().unwrap(); + let status = me.try_wait().unwrap().unwrap(); assert!(!status.success()); - let status = me.try_wait().unwrap(); + let status = me.try_wait().unwrap().unwrap(); assert!(!status.success()); let mut me = Command::new(env::current_exe().unwrap()) @@ -51,17 +50,17 @@ fn main() { .unwrap(); loop { match me.try_wait() { - Ok(res) => { + Ok(Some(res)) => { assert!(res.success()); break } - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { + Ok(None) => { thread::sleep(Duration::from_millis(1)); } Err(e) => panic!("error in try_wait: {}", e), } } - let status = me.try_wait().unwrap(); + let status = me.try_wait().unwrap().unwrap(); assert!(status.success()); } diff --git a/src/test/rustdoc/test_option_check/bar.rs b/src/test/rustdoc/test_option_check/bar.rs new file mode 100644 index 00000000000..51daa807526 --- /dev/null +++ b/src/test/rustdoc/test_option_check/bar.rs @@ -0,0 +1,19 @@ +// 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. + +// compile-flags: --test +// check-test-line-numbers-match + +/// This looks like another awesome test! +/// +/// ``` +/// println!("foo?"); +/// ``` +pub fn foooo() {} diff --git a/src/test/rustdoc/test_option_check/test.rs b/src/test/rustdoc/test_option_check/test.rs index b2afe43204d..a9578c5f434 100644 --- a/src/test/rustdoc/test_option_check/test.rs +++ b/src/test/rustdoc/test_option_check/test.rs @@ -11,6 +11,8 @@ // compile-flags: --test // check-test-line-numbers-match +pub mod bar; + /// This is a Foo; /// /// ``` |
