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/ui | |
| parent | a97cd17f5d71fb4ec362f4fbd79373a6e7ed7b82 (diff) | |
| parent | a06d333a148f6c620044a765f47497f1ed1e4dde (diff) | |
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/ui')
| -rw-r--r-- | src/test/ui/issue-47511.rs | 35 | ||||
| -rw-r--r-- | src/test/ui/issue-47511.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/issue-47706.rs | 24 | ||||
| -rw-r--r-- | src/test/ui/issue-47706.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/variadic-ffi-3.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/variadic-ffi-3.stderr | 36 |
6 files changed, 112 insertions, 24 deletions
diff --git a/src/test/ui/issue-47511.rs b/src/test/ui/issue-47511.rs new file mode 100644 index 00000000000..df4ff301bc9 --- /dev/null +++ b/src/test/ui/issue-47511.rs @@ -0,0 +1,35 @@ +// 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. + +// Regression test for #47511: anonymous lifetimes can appear +// unconstrained in a return type, but only if they appear just once +// in the input, as the input to a projection. + +fn f(_: X) -> X { + //~^ ERROR return type references an anonymous lifetime + unimplemented!() +} + +fn g<'a>(_: X<'a>) -> X<'a> { + //~^ ERROR return type references lifetime `'a`, which is not constrained + unimplemented!() +} + +type X<'a> = <&'a () as Trait>::Value; + +trait Trait { + type Value; +} + +impl<'a> Trait for &'a () { + type Value = (); +} + +fn main() {} diff --git a/src/test/ui/issue-47511.stderr b/src/test/ui/issue-47511.stderr new file mode 100644 index 00000000000..fabd6b6c253 --- /dev/null +++ b/src/test/ui/issue-47511.stderr @@ -0,0 +1,16 @@ +error[E0581]: return type references an anonymous lifetime which is not constrained by the fn input types + --> $DIR/issue-47511.rs:15:15 + | +15 | fn f(_: X) -> X { + | ^ + | + = note: lifetimes appearing in an associated type are not considered constrained + +error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types + --> $DIR/issue-47511.rs:20:23 + | +20 | fn g<'a>(_: X<'a>) -> X<'a> { + | ^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issue-47706.rs b/src/test/ui/issue-47706.rs new file mode 100644 index 00000000000..24a0f66f5b1 --- /dev/null +++ b/src/test/ui/issue-47706.rs @@ -0,0 +1,24 @@ +// 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. + +pub struct Foo { + foo: Option<i32>, +} + +impl Foo { + pub fn new(foo: Option<i32>, _: ()) -> Foo { + Foo { foo } + } + + pub fn map(self) -> Option<Foo> { + self.foo.map(Foo::new) + } + //~^^ ERROR function is expected to take 1 argument, but it takes 2 arguments [E0593] +} diff --git a/src/test/ui/issue-47706.stderr b/src/test/ui/issue-47706.stderr new file mode 100644 index 00000000000..0916dc64292 --- /dev/null +++ b/src/test/ui/issue-47706.stderr @@ -0,0 +1,13 @@ +error[E0601]: main function not found + +error[E0593]: function is expected to take 1 argument, but it takes 2 arguments + --> $DIR/issue-47706.rs:21:18 + | +16 | pub fn new(foo: Option<i32>, _: ()) -> Foo { + | ------------------------------------------ takes 2 arguments +... +21 | self.foo.map(Foo::new) + | ^^^ expected function that takes 1 argument + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/variadic-ffi-3.rs b/src/test/ui/variadic-ffi-3.rs index 12beebc181b..9807952c636 100644 --- a/src/test/ui/variadic-ffi-3.rs +++ b/src/test/ui/variadic-ffi-3.rs @@ -31,11 +31,11 @@ fn main() { //~| expected type `extern "C" fn(isize, u8, ...)` //~| found type `extern "C" fn(isize, u8) {bar}` - foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double` - foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int` - foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function, cast to `c_int` - foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function, cast to `c_uint` - foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function, cast to `c_int` - foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function, cast to `c_uint` + foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function + foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function + foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function + foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function + foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function + foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function } } diff --git a/src/test/ui/variadic-ffi-3.stderr b/src/test/ui/variadic-ffi-3.stderr index be158c1e398..54275fbc4f2 100644 --- a/src/test/ui/variadic-ffi-3.stderr +++ b/src/test/ui/variadic-ffi-3.stderr @@ -34,41 +34,41 @@ error[E0308]: mismatched types = note: expected type `extern "C" fn(isize, u8, ...)` found type `extern "C" fn(isize, u8) {bar}` -error[E0617]: can't pass `f32` to variadic function, cast to `c_double` +error[E0617]: can't pass `f32` to variadic function --> $DIR/variadic-ffi-3.rs:34:19 | -34 | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double` - | ^^^^ +34 | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function + | ^^^^ help: cast the value to `c_double`: `3f32 as c_double` -error[E0617]: can't pass `bool` to variadic function, cast to `c_int` +error[E0617]: can't pass `bool` to variadic function --> $DIR/variadic-ffi-3.rs:35:19 | -35 | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int` - | ^^^^ +35 | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function + | ^^^^ help: cast the value to `c_int`: `true as c_int` -error[E0617]: can't pass `i8` to variadic function, cast to `c_int` +error[E0617]: can't pass `i8` to variadic function --> $DIR/variadic-ffi-3.rs:36:19 | -36 | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function, cast to `c_int` - | ^^^ +36 | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function + | ^^^ help: cast the value to `c_int`: `1i8 as c_int` -error[E0617]: can't pass `u8` to variadic function, cast to `c_uint` +error[E0617]: can't pass `u8` to variadic function --> $DIR/variadic-ffi-3.rs:37:19 | -37 | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function, cast to `c_uint` - | ^^^ +37 | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function + | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` -error[E0617]: can't pass `i16` to variadic function, cast to `c_int` +error[E0617]: can't pass `i16` to variadic function --> $DIR/variadic-ffi-3.rs:38:19 | -38 | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function, cast to `c_int` - | ^^^^ +38 | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function + | ^^^^ help: cast the value to `c_int`: `1i16 as c_int` -error[E0617]: can't pass `u16` to variadic function, cast to `c_uint` +error[E0617]: can't pass `u16` to variadic function --> $DIR/variadic-ffi-3.rs:39:19 | -39 | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function, cast to `c_uint` - | ^^^^ +39 | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function + | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` error: aborting due to 10 previous errors |
