Improved mechanism for naming regions in non-annotated types.
This commit is contained in:
parent
b377e7bbfb
commit
f44807ae1e
9 changed files with 124 additions and 46 deletions
17
src/test/ui/issue-52533-1.nll.stderr
Normal file
17
src/test/ui/issue-52533-1.nll.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
warning: not reporting region error due to nll
|
||||
--> $DIR/issue-52533-1.rs:19:18
|
||||
|
|
||||
LL | gimme(|x, y| y)
|
||||
| ^
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/issue-52533-1.rs:19:18
|
||||
|
|
||||
LL | gimme(|x, y| y)
|
||||
| - - ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
|
||||
| | |
|
||||
| | has type `&Foo<'_, '1, u32>`
|
||||
| has type `&Foo<'_, '2, u32>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
21
src/test/ui/issue-52533-1.rs
Normal file
21
src/test/ui/issue-52533-1.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// 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.
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
struct Foo<'a, 'b, T: 'a + 'b> { x: &'a T, y: &'b T }
|
||||
|
||||
fn gimme(_: impl for<'a, 'b, 'c> FnOnce(&'a Foo<'a, 'b, u32>,
|
||||
&'a Foo<'a, 'c, u32>) -> &'a Foo<'a, 'b, u32>) { }
|
||||
|
||||
fn main() {
|
||||
gimme(|x, y| y)
|
||||
//~^ ERROR mismatched types [E0308]
|
||||
}
|
||||
22
src/test/ui/issue-52533-1.stderr
Normal file
22
src/test/ui/issue-52533-1.stderr
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-52533-1.rs:19:18
|
||||
|
|
||||
LL | gimme(|x, y| y)
|
||||
| ^ lifetime mismatch
|
||||
|
|
||||
= note: expected type `&Foo<'_, '_, u32>`
|
||||
found type `&Foo<'_, '_, u32>`
|
||||
note: the anonymous lifetime #4 defined on the body at 19:11...
|
||||
--> $DIR/issue-52533-1.rs:19:11
|
||||
|
|
||||
LL | gimme(|x, y| y)
|
||||
| ^^^^^^^^
|
||||
note: ...does not necessarily outlive the anonymous lifetime #3 defined on the body at 19:11
|
||||
--> $DIR/issue-52533-1.rs:19:11
|
||||
|
|
||||
LL | gimme(|x, y| y)
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -11,7 +11,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
|
|||
| - - ^^^^^^ free region requires that `'1` must outlive `'2`
|
||||
| | |
|
||||
| | has type `&'1 i32`
|
||||
| has type `&'2 mut &'3 i32`
|
||||
| has type `&mut &'2 i32`
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/escape-argument-callee.rs:36:38
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ error: unsatisfied lifetime constraints
|
|||
--> $DIR/propagate-approximated-fail-no-postdom.rs:57:13
|
||||
|
|
||||
LL | |_outlives1, _outlives2, _outlives3, x, y| {
|
||||
| ---------- ---------- has type `std::cell::Cell<&'3 &'4 u32>`
|
||||
| ---------- ---------- has type `std::cell::Cell<&'2 &u32>`
|
||||
| |
|
||||
| has type `std::cell::Cell<&'1 &'2 u32>`
|
||||
| has type `std::cell::Cell<&&'1 u32>`
|
||||
...
|
||||
LL | demand_y(x, y, p) //~ ERROR
|
||||
| ^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'3`
|
||||
| ^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/propagate-approximated-fail-no-postdom.rs:53:9
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ error: unsatisfied lifetime constraints
|
|||
--> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:9
|
||||
|
|
||||
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
||||
| --------- - has type `&'1 std::cell::Cell<&'2 u32>`
|
||||
| --------- - has type `&std::cell::Cell<&'1 u32>`
|
||||
| |
|
||||
| has type `&'3 std::cell::Cell<&'4 &'5 u32>`
|
||||
| has type `&std::cell::Cell<&'2 &u32>`
|
||||
LL | // Only works if 'x: 'y:
|
||||
LL | demand_y(x, y, x.get())
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'3`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:45:47
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ error: unsatisfied lifetime constraints
|
|||
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:9
|
||||
|
|
||||
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
|
||||
| ---------- ---------- has type `&'4 std::cell::Cell<&'5 &'6 u32>`
|
||||
| ---------- ---------- has type `&std::cell::Cell<&'2 &u32>`
|
||||
| |
|
||||
| has type `&'1 std::cell::Cell<&'2 &'3 u32>`
|
||||
| has type `&std::cell::Cell<&'1 &u32>`
|
||||
LL | // Only works if 'x: 'y:
|
||||
LL | demand_y(x, y, x.get())
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'4`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:49:47
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue