diff options
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/cast-rfc0401-2.rs | 20 | ||||
| -rw-r--r-- | src/test/compile-fail/cast-rfc0401.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/derived-errors/issue-30580.rs (renamed from src/test/compile-fail/issue-30580.rs) | 0 | ||||
| -rw-r--r-- | src/test/compile-fail/derived-errors/issue-31997.rs | 27 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-26480.rs | 2 |
5 files changed, 48 insertions, 3 deletions
diff --git a/src/test/compile-fail/cast-rfc0401-2.rs b/src/test/compile-fail/cast-rfc0401-2.rs new file mode 100644 index 00000000000..fdc250f9946 --- /dev/null +++ b/src/test/compile-fail/cast-rfc0401-2.rs @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +// RFC 401 test extracted into distinct file. This is because some the +// change to suppress "derived" errors wound up suppressing this error +// message, since the fallback for `3` doesn't occur. + +fn main() { + let _ = 3 as bool; + //~^ ERROR cannot cast as `bool` + //~| HELP see a detailed explanation + //~| HELP compare with zero +} diff --git a/src/test/compile-fail/cast-rfc0401.rs b/src/test/compile-fail/cast-rfc0401.rs index dcd49e34bb2..fcfb5706e5d 100644 --- a/src/test/compile-fail/cast-rfc0401.rs +++ b/src/test/compile-fail/cast-rfc0401.rs @@ -58,7 +58,7 @@ fn main() let _ = f as *const u8; //~^ ERROR casting //~^^ HELP through a usize first - let _ = 3 as bool; + let _ = 3_i32 as bool; //~^ ERROR cannot cast as `bool` //~^^ HELP compare with zero //~^^^ HELP run `rustc --explain E0054` to see a detailed explanation diff --git a/src/test/compile-fail/issue-30580.rs b/src/test/compile-fail/derived-errors/issue-30580.rs index 88d4aef6d9d..88d4aef6d9d 100644 --- a/src/test/compile-fail/issue-30580.rs +++ b/src/test/compile-fail/derived-errors/issue-30580.rs diff --git a/src/test/compile-fail/derived-errors/issue-31997.rs b/src/test/compile-fail/derived-errors/issue-31997.rs new file mode 100644 index 00000000000..cf283f6d3e4 --- /dev/null +++ b/src/test/compile-fail/derived-errors/issue-31997.rs @@ -0,0 +1,27 @@ +// 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 <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. + +// Test that the resolve failure does not lead to downstream type errors. +// See issue #31997. + +trait TheTrait { } + +fn closure<F, T>(x: F) -> Result<T, ()> + where F: FnMut() -> T, T: TheTrait, +{ + unimplemented!() +} + +fn foo() -> Result<(), ()> { + try!(closure(|| bar(0 as *mut _))); //~ ERROR unresolved name `bar` + Ok(()) +} + +fn main() { } diff --git a/src/test/compile-fail/issue-26480.rs b/src/test/compile-fail/issue-26480.rs index 903df42291c..44aff623860 100644 --- a/src/test/compile-fail/issue-26480.rs +++ b/src/test/compile-fail/issue-26480.rs @@ -31,7 +31,6 @@ macro_rules! write { macro_rules! cast { ($x:expr) => ($x as ()) - //~^ ERROR non-scalar cast: `i32` as `()` } fn main() { @@ -40,5 +39,4 @@ fn main() { //~^ NOTE in this expansion of write! cast!(2); - //~^ NOTE in this expansion of cast! } |
