Auto merge of #46733 - nikomatsakis:nll-master-to-rust-master-5, r=arielb1

nll part 5

Next round of changes from the nll-master branch.

Extensions:

- we now propagate ty-region-outlives constraints out of closures and into their creator when necessary
- we fix a few ICEs that can occur by doing liveness analysis (and the resulting normalization) during type-checking
- we handle the implicit region bound that assumes that each type `T` outlives the fn body
- we handle normalization of inputs/outputs in fn signatures

Not included in this PR (will come next):

- handling `impl Trait`
- tracking causal information
- extended errors

r? @arielb1
This commit is contained in:
bors 2017-12-20 03:58:15 +00:00
commit 588f7db8ef
78 changed files with 4056 additions and 645 deletions

View file

@ -14,9 +14,9 @@
fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 {
let g: fn(_, _) -> _ = |_x, y| y;
//~^ ERROR free region `'b` does not outlive free region `'a`
g
//~^ WARNING not reporting region error due to -Znll
//~| ERROR free region `'b` does not outlive free region `'a`
}
fn main() {}

View file

@ -45,8 +45,8 @@ fn bar<'a>(x: &'a u32) -> &'static u32 {
// as part of checking the `ReifyFnPointer`.
let f: fn(_) -> _ = foo;
//~^ WARNING not reporting region error due to -Znll
//~| ERROR free region `'_#1r` does not outlive free region `'static`
f(x)
//~^ ERROR free region `'_#1r` does not outlive free region `'static`
}
fn main() {}

View file

@ -17,8 +17,8 @@ fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
// in `g`. These are related via the `UnsafeFnPointer` cast.
let g: unsafe fn(_) -> _ = f;
//~^ WARNING not reporting region error due to -Znll
//~| ERROR free region `'_#1r` does not outlive free region `'static`
unsafe { g(input) }
//~^ ERROR free region `'_#1r` does not outlive free region `'static`
}
fn main() {}