diff options
| author | bors <bors@rust-lang.org> | 2018-01-26 17:41:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-01-26 17:41:36 +0000 |
| commit | bacb5c58dfdde7c35e99b2b0d8171238cc33cf6c (patch) | |
| tree | a4a44364f143350bb7262ca8e63612e2ee71f6ed /src/test/compile-fail | |
| parent | a97cd17f5d71fb4ec362f4fbd79373a6e7ed7b82 (diff) | |
| parent | a06d333a148f6c620044a765f47497f1ed1e4dde (diff) | |
| download | rust-bacb5c58dfdde7c35e99b2b0d8171238cc33cf6c.tar.gz rust-bacb5c58dfdde7c35e99b2b0d8171238cc33cf6c.zip | |
Auto merge of #47748 - alexcrichton:rollup, r=alexcrichton
Rollup of 19 pull requests - Successful merges: #47415, #47437, #47439, #47453, #47460, #47502, #47529, #47600, #47607, #47618, #47626, #47656, #47668, #47696, #47701, #47705, #47710, #47711, #47719 - Failed merges: #47455, #47521
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/E0617.rs | 18 | ||||
| -rw-r--r-- | src/test/compile-fail/dep-graph-variance-alias.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/empty-never-array.rs | 27 | ||||
| -rw-r--r-- | src/test/compile-fail/impl-trait/infinite-impl-trait-issue-38064.rs | 39 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-32201.rs | 3 | ||||
| -rw-r--r-- | src/test/compile-fail/panic-runtime/auxiliary/depends.rs (renamed from src/test/compile-fail/panic-runtime/auxiliary/runtime-depending-on-panic-runtime.rs) | 0 | ||||
| -rw-r--r-- | src/test/compile-fail/panic-runtime/runtime-depend-on-needs-runtime.rs | 4 |
7 files changed, 83 insertions, 10 deletions
diff --git a/src/test/compile-fail/E0617.rs b/src/test/compile-fail/E0617.rs index 7b769ff4ae2..9375fd9cade 100644 --- a/src/test/compile-fail/E0617.rs +++ b/src/test/compile-fail/E0617.rs @@ -17,16 +17,22 @@ extern { fn main() { unsafe { printf(::std::ptr::null(), 0f32); - //~^ ERROR can't pass `f32` to variadic function, cast to `c_double` [E0617] + //~^ ERROR can't pass `f32` to variadic function + //~| HELP cast the value to `c_double` printf(::std::ptr::null(), 0i8); - //~^ ERROR can't pass `i8` to variadic function, cast to `c_int` [E0617] + //~^ ERROR can't pass `i8` to variadic function + //~| HELP cast the value to `c_int` printf(::std::ptr::null(), 0i16); - //~^ ERROR can't pass `i16` to variadic function, cast to `c_int` [E0617] + //~^ ERROR can't pass `i16` to variadic function + //~| HELP cast the value to `c_int` printf(::std::ptr::null(), 0u8); - //~^ ERROR can't pass `u8` to variadic function, cast to `c_uint` [E0617] + //~^ ERROR can't pass `u8` to variadic function + //~| HELP cast the value to `c_uint` printf(::std::ptr::null(), 0u16); - //~^ ERROR can't pass `u16` to variadic function, cast to `c_uint` [E0617] + //~^ ERROR can't pass `u16` to variadic function + //~| HELP cast the value to `c_uint` printf(::std::ptr::null(), printf); - //~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function, cast to `unsafe extern "C" fn(*const i8, ...)` [E0617] + //~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function + //~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)` } } diff --git a/src/test/compile-fail/dep-graph-variance-alias.rs b/src/test/compile-fail/dep-graph-variance-alias.rs index 9b621a13fc4..18cfd001804 100644 --- a/src/test/compile-fail/dep-graph-variance-alias.rs +++ b/src/test/compile-fail/dep-graph-variance-alias.rs @@ -23,7 +23,7 @@ struct Foo<T> { f: T } -#[rustc_if_this_changed] +#[rustc_if_this_changed(Krate)] type TypeAlias<T> = Foo<T>; #[rustc_then_this_would_need(ItemVariances)] //~ ERROR OK diff --git a/src/test/compile-fail/empty-never-array.rs b/src/test/compile-fail/empty-never-array.rs new file mode 100644 index 00000000000..53b24e17319 --- /dev/null +++ b/src/test/compile-fail/empty-never-array.rs @@ -0,0 +1,27 @@ +// 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(never_type)] + +enum Helper<T, U> { + T(T, [!; 0]), + #[allow(dead_code)] + U(U), +} + +fn transmute<T, U>(t: T) -> U { + let Helper::U(u) = Helper::T(t, []); + //~^ ERROR refutable pattern in local binding: `T(_, _)` not covered + u +} + +fn main() { + println!("{:?}", transmute::<&str, (*const u8, u64)>("type safety")); +} diff --git a/src/test/compile-fail/impl-trait/infinite-impl-trait-issue-38064.rs b/src/test/compile-fail/impl-trait/infinite-impl-trait-issue-38064.rs new file mode 100644 index 00000000000..abde9689bd6 --- /dev/null +++ b/src/test/compile-fail/impl-trait/infinite-impl-trait-issue-38064.rs @@ -0,0 +1,39 @@ +// Copyright 2016 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 attempts to construct infinite types via impl trait fail +// in a graceful way. +// +// Regression test for #38064. + +// error-pattern:overflow evaluating the requirement `impl Quux` + +#![feature(conservative_impl_trait)] + +trait Quux {} + +fn foo() -> impl Quux { + struct Foo<T>(T); + impl<T> Quux for Foo<T> {} + Foo(bar()) +} + +fn bar() -> impl Quux { + struct Bar<T>(T); + impl<T> Quux for Bar<T> {} + Bar(foo()) +} + +// effectively: +// struct Foo(Bar); +// struct Bar(Foo); +// should produce an error about infinite size + +fn main() { foo(); } diff --git a/src/test/compile-fail/issue-32201.rs b/src/test/compile-fail/issue-32201.rs index bcc53df68a3..bf9f8ecbc80 100644 --- a/src/test/compile-fail/issue-32201.rs +++ b/src/test/compile-fail/issue-32201.rs @@ -17,6 +17,7 @@ fn bar(_: *const u8) {} fn main() { unsafe { foo(0, bar); - //~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function, cast to `fn(*const u8)` + //~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function + //~| HELP cast the value to `fn(*const u8)` } } diff --git a/src/test/compile-fail/panic-runtime/auxiliary/runtime-depending-on-panic-runtime.rs b/src/test/compile-fail/panic-runtime/auxiliary/depends.rs index b90dec9281b..b90dec9281b 100644 --- a/src/test/compile-fail/panic-runtime/auxiliary/runtime-depending-on-panic-runtime.rs +++ b/src/test/compile-fail/panic-runtime/auxiliary/depends.rs diff --git a/src/test/compile-fail/panic-runtime/runtime-depend-on-needs-runtime.rs b/src/test/compile-fail/panic-runtime/runtime-depend-on-needs-runtime.rs index 0681f991067..7cfdacbd983 100644 --- a/src/test/compile-fail/panic-runtime/runtime-depend-on-needs-runtime.rs +++ b/src/test/compile-fail/panic-runtime/runtime-depend-on-needs-runtime.rs @@ -9,7 +9,7 @@ // except according to those terms. // aux-build:needs-panic-runtime.rs -// aux-build:runtime-depending-on-panic-runtime.rs +// aux-build:depends.rs // error-pattern:cannot depend on a crate that needs a panic runtime -extern crate runtime_depending_on_panic_runtime; +extern crate depends; |
