diff options
| author | Cengiz Can <123910+cengizIO@users.noreply.github.com> | 2017-08-29 02:01:53 +0300 |
|---|---|---|
| committer | Cengiz Can <cengizc@gmail.com> | 2017-11-12 18:56:45 +0300 |
| commit | da52563bf5c0a048e81ad10e5a3c4e432743083a (patch) | |
| tree | 21182603436f05efb8b3ce1d54d19980d6499c1a /src/test/compile-fail | |
| parent | 4b6f7252a135a3fd1dba6f5e002b9d3d3af034b9 (diff) | |
| download | rust-da52563bf5c0a048e81ad10e5a3c4e432743083a.tar.gz rust-da52563bf5c0a048e81ad10e5a3c4e432743083a.zip | |
Improve SubSupConflict case with one named, one anonymous lifetime parameter #42701
Diffstat (limited to 'src/test/compile-fail')
16 files changed, 26 insertions, 24 deletions
diff --git a/src/test/compile-fail/associated-types-project-from-hrtb-in-fn-body.rs b/src/test/compile-fail/associated-types-project-from-hrtb-in-fn-body.rs index 285a77d6b65..5451a20d816 100644 --- a/src/test/compile-fail/associated-types-project-from-hrtb-in-fn-body.rs +++ b/src/test/compile-fail/associated-types-project-from-hrtb-in-fn-body.rs @@ -30,7 +30,7 @@ fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>( { // x and y here have two distinct lifetimes: let z: I::A = if cond { x } else { y }; - //~^ ERROR cannot infer + //~^ ERROR lifetime mismatch } pub fn main() {} diff --git a/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs b/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs index 0e822aff01e..a5e8f4068e6 100644 --- a/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs +++ b/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs @@ -50,9 +50,10 @@ fn baz<'a,'b>(x: &'a u32) -> &'static u32 { #[cfg(krisskross)] // two instantiations, mixing and matching: BAD fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { - let a = bar(foo, y); //[krisskross]~ ERROR E0495 - let b = bar(foo, x); //[krisskross]~ ERROR E0495 - (a, b) + let a = bar(foo, y); + let b = bar(foo, x); + (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623] + //[krisskross]~^ ERROR 55:8: 55:9: lifetime mismatch [E0623] } #[rustc_error] diff --git a/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs b/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs index 10fe612980d..3920024c8e8 100644 --- a/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs +++ b/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs @@ -45,9 +45,9 @@ fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { #[cfg(oneuse)] // one instantiation: BAD fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { let f = foo; // <-- No consistent type can be inferred for `f` here. - let a = bar(f, x); //[oneuse]~^ ERROR E0495 + let a = bar(f, x); let b = bar(f, y); - (a, b) + (a, b) //[oneuse]~ ERROR E0623 } #[cfg(transmute)] // one instantiations: BAD @@ -60,9 +60,10 @@ fn baz<'a,'b>(x: Type<'a>) -> Type<'static> { #[cfg(krisskross)] // two instantiations, mixing and matching: BAD fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { - let a = bar(foo, y); //[krisskross]~ ERROR E0495 - let b = bar(foo, x); //[krisskross]~ ERROR E0495 - (a, b) + let a = bar(foo, y); + let b = bar(foo, x); + (a, b) //[krisskross]~ ERROR E0623 + //[krisskross]~^ ERROR E0623 } #[rustc_error] diff --git a/src/test/compile-fail/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs b/src/test/compile-fail/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs index eee407472bf..af85e68f5de 100644 --- a/src/test/compile-fail/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs +++ b/src/test/compile-fail/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs @@ -17,7 +17,7 @@ struct S<'a> { fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> { S { pointer: &mut *p.pointer } - //~^ ERROR cannot infer + //~^ ERROR lifetime mismatch } fn main() { diff --git a/src/test/compile-fail/issue-17728.rs b/src/test/compile-fail/issue-17728.rs index 9724d17bef1..8516a8ea52e 100644 --- a/src/test/compile-fail/issue-17728.rs +++ b/src/test/compile-fail/issue-17728.rs @@ -21,9 +21,9 @@ trait TraversesWorld { fn attemptTraverse(&self, room: &Room, directionStr: &str) -> Result<&Room, &str> { let direction = str_to_direction(directionStr); let maybe_room = room.direction_to_room.get(&direction); - //~^ ERROR cannot infer an appropriate lifetime for autoref due to conflicting requirements match maybe_room { Some(entry) => Ok(entry), + //~^ ERROR 25:28: 25:37: lifetime mismatch [E0623] _ => Err("Direction does not exist in room.") } } diff --git a/src/test/compile-fail/issue-40288-2.rs b/src/test/compile-fail/issue-40288-2.rs index c1e8cb8b6de..e16a7ecf6b9 100644 --- a/src/test/compile-fail/issue-40288-2.rs +++ b/src/test/compile-fail/issue-40288-2.rs @@ -12,12 +12,12 @@ fn prove_static<T: 'static + ?Sized>(_: &'static T) {} fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { let mut out = [x]; - //~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements { let slice: &mut [_] = &mut out; slice[0] = y; } out[0] + //~^ ERROR 19:5: 19:11: explicit lifetime required in the type of `y` [E0621] } struct Struct<T, U: ?Sized> { @@ -27,12 +27,12 @@ struct Struct<T, U: ?Sized> { fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { let mut out = Struct { head: x, _tail: [()] }; - //~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements { let dst: &mut Struct<_, [()]> = &mut out; dst.head = y; } out.head + //~^ ERROR 34:5: 34:13: explicit lifetime required in the type of `y` [E0621] } fn main() { diff --git a/src/test/compile-fail/object-lifetime-default-from-box-error.rs b/src/test/compile-fail/object-lifetime-default-from-box-error.rs index c0dd5200f6c..c50f425b2c0 100644 --- a/src/test/compile-fail/object-lifetime-default-from-box-error.rs +++ b/src/test/compile-fail/object-lifetime-default-from-box-error.rs @@ -38,7 +38,7 @@ fn store(ss: &mut SomeStruct, b: Box<SomeTrait>) { fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) { // Here we override the lifetimes explicitly, and so naturally we get an error. - ss.r = b; //~ ERROR cannot infer an appropriate lifetime + ss.r = b; //~ ERROR 41:12: 41:13: explicit lifetime required in the type of `ss` [E0621] } fn main() { diff --git a/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs b/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs index f886c0255cc..e3d96f52e81 100644 --- a/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs @@ -21,7 +21,7 @@ fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y); //~ ERROR cannot infer + a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623] } fn d() { diff --git a/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs b/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs index bae9608c3f0..d8d12444ddd 100644 --- a/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs @@ -23,7 +23,7 @@ fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y, z); //~ ERROR cannot infer + a(x, y, z); //~ ERROR 26:7: 26:8: lifetime mismatch [E0623] } fn d() { diff --git a/src/test/compile-fail/regions-bounded-method-type-parameters-cross-crate.rs b/src/test/compile-fail/regions-bounded-method-type-parameters-cross-crate.rs index 1eb36e34ab3..24e4c5fbd91 100644 --- a/src/test/compile-fail/regions-bounded-method-type-parameters-cross-crate.rs +++ b/src/test/compile-fail/regions-bounded-method-type-parameters-cross-crate.rs @@ -27,7 +27,7 @@ fn call_into_maybe_owned<'x,F:IntoMaybeOwned<'x>>(f: F) { fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. - a.bigger_region(b) //~ ERROR cannot infer + a.bigger_region(b) //~ ERROR 30:7: 30:20: lifetime mismatch [E0623] } fn main() { } diff --git a/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs b/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs index f13d8a60894..3e9d2aa6c3b 100644 --- a/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs +++ b/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs @@ -27,7 +27,7 @@ fn caller1<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. - f.method(b); //~ ERROR cannot infer + f.method(b); //~ ERROR 30:7: 30:13: lifetime mismatch [E0623] } fn caller3<'a,'b:'a,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { diff --git a/src/test/compile-fail/regions-creating-enums3.rs b/src/test/compile-fail/regions-creating-enums3.rs index 4c8484540aa..dcc579d26c1 100644 --- a/src/test/compile-fail/regions-creating-enums3.rs +++ b/src/test/compile-fail/regions-creating-enums3.rs @@ -14,7 +14,7 @@ enum ast<'a> { } fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { - ast::add(x, y) //~ ERROR cannot infer + ast::add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623] } fn main() { diff --git a/src/test/compile-fail/regions-free-region-ordering-callee.rs b/src/test/compile-fail/regions-free-region-ordering-callee.rs index 1893395e2b0..073a4f79b05 100644 --- a/src/test/compile-fail/regions-free-region-ordering-callee.rs +++ b/src/test/compile-fail/regions-free-region-ordering-callee.rs @@ -20,13 +20,13 @@ fn ordering1<'a, 'b>(x: &'a &'b usize) -> &'a usize { fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { // However, it is not safe to assume that 'b <= 'a - &*y //~ ERROR cannot infer + &*y //~ ERROR 23:5: 23:8: lifetime mismatch [E0623] } fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { // Do not infer an ordering from the return value. let z: &'b usize = &*x; - //~^ ERROR cannot infer + //~^ ERROR 28:24: 28:27: lifetime mismatch [E0623] panic!(); } diff --git a/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs b/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs index ef1c58bf972..5955619ea92 100644 --- a/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs +++ b/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs @@ -21,7 +21,7 @@ fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y); //~ ERROR E0495 + a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623] } fn d() { diff --git a/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref-mut-ref.rs b/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref-mut-ref.rs index 9743f11c966..f6f1a189e5e 100644 --- a/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref-mut-ref.rs +++ b/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref-mut-ref.rs @@ -11,7 +11,7 @@ // Issue #8624. Test for reborrowing with 3 levels, not just two. fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { - &mut ***p //~ ERROR cannot infer + &mut ***p //~ ERROR 14:5: 14:14: lifetime mismatch [E0623] } fn main() { diff --git a/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref.rs b/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref.rs index 399ebd6a2a7..7270b477d2d 100644 --- a/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref.rs +++ b/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref.rs @@ -13,7 +13,7 @@ // for `'a` (which must be a sublifetime of `'b`). fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { - &mut **p //~ ERROR cannot infer + &mut **p //~ ERROR 16:5: 16:13: lifetime mismatch [E0623] } fn main() { |
