diff options
| author | Tim Neumann <mail@timnn.me> | 2017-09-17 13:19:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-17 13:19:05 +0200 |
| commit | efdcd5efef53dd1fb781d4db7aea8834a8ebaffe (patch) | |
| tree | e20ab7a106a5cd3d5135eb959122e905b362a145 /src/test | |
| parent | eea2f5596a0ee32d129d0dc9a64439cbe4bcf802 (diff) | |
| parent | 52294434b0c8b8f792cf81c6e1816006358e64b2 (diff) | |
| download | rust-efdcd5efef53dd1fb781d4db7aea8834a8ebaffe.tar.gz rust-efdcd5efef53dd1fb781d4db7aea8834a8ebaffe.zip | |
Rollup merge of #44549 - gaurikholkar:master, r=arielb1
extend E0623 for earlybound and latebound for structs This fixes #44508 r? @nikomatsakis
Diffstat (limited to 'src/test')
4 files changed, 60 insertions, 0 deletions
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs new file mode 100644 index 00000000000..0fef709ae53 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs @@ -0,0 +1,21 @@ +// 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. +struct Ref<'a> { + x: &'a u32, +} + +fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) + where &'a (): Sized, + &'b u32: Sized +{ + x.push(y); +} + +fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr new file mode 100644 index 00000000000..59bf5d17222 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:18:12 + | +14 | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) + | ------- ------- these two types are declared with different lifetimes... +... +18 | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs new file mode 100644 index 00000000000..a91d0b55dc7 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs @@ -0,0 +1,18 @@ +// 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. +struct Ref<'a> { + x: &'a u32, +} + +fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) { + x.push(y); +} + +fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr new file mode 100644 index 00000000000..87835121068 --- /dev/null +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr @@ -0,0 +1,10 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:15:12 + | +14 | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) { + | ------- ------- these two types are declared with different lifetimes... +15 | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + |
