]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #45538 - nikomatsakis:nll-liveness, r=pnkfelix
authorbors <bors@rust-lang.org>
Wed, 1 Nov 2017 18:14:13 +0000 (18:14 +0000)
committerbors <bors@rust-lang.org>
Wed, 1 Nov 2017 18:14:13 +0000 (18:14 +0000)
enable non-lexical lifetimes in the MIR borrow checker

This PR, joint work with @spastorino, fills out the NLL infrastructure and integrates it with the borrow checker. **Don't get too excited:** it includes still a number of hacks (the subtyping code is particularly hacky). However, it *does* kinda' work. =)

The final commit demonstrates this by including a test that -- with both the AST borrowck and MIR borrowck -- reports an error by default. But if you pass `-Znll`, you only get an error from the AST borrowck, demonstrating that the integration succeeds:

```
struct MyStruct {
    field: String
}

fn main() {
    let mut my_struct = MyStruct { field: format!("Hello") };

    let value = &my_struct.field;
    if value.is_empty() {
        my_struct.field.push_str("Hello, world!");
        //~^ ERROR cannot borrow (Ast)
    }
}
```

1  2 
src/librustc_driver/driver.rs

Simple merge