Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLL / MIR-borrowck regression in liballoc #48224

Closed
Aaron1011 opened this issue Feb 15, 2018 · 1 comment
Closed

NLL / MIR-borrowck regression in liballoc #48224

Aaron1011 opened this issue Feb 15, 2018 · 1 comment
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) C-bug Category: This is a bug. NLL-fixed-by-NLL Bugs fixed, but only when NLL is enabled. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.

Comments

@Aaron1011
Copy link
Member

When compiling rustc with NLL (full command: RUSTFLAGS_STAGE_NOT_0='-Z borrowck=mir -Z nll -Z two-phase-borrows' ./x.py build ), liballoc fails to build with the following errors:

error[E0311]: the parameter type `K` may not live long enough
   --> liballoc/btree/map.rs:158:19
    |
158 |             match node.force() {
    |                   ^^^^
    |
    = help: consider adding an explicit lifetime bound for `K`
note: the parameter type `K` must be valid for the anonymous lifetime #1 defined on the function body at 152:9...
   --> liballoc/btree/map.rs:152:9
    |
152 | /         fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
153 | |                                                                  K,
154 | |                                                                  V,
155 | |                                                                  marker::LeafOrInternal>)
...   |
213 | |             }
214 | |         }
    | |_________^

error[E0311]: the parameter type `V` may not live long enough
   --> liballoc/btree/map.rs:158:19
    |
158 |             match node.force() {
    |                   ^^^^
    |
    = help: consider adding an explicit lifetime bound for `V`
note: the parameter type `V` must be valid for the anonymous lifetime #1 defined on the function body at 152:9...
   --> liballoc/btree/map.rs:152:9
    |
152 | /         fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
153 | |                                                                  K,
154 | |                                                                  V,
155 | |                                                                  marker::LeafOrInternal>)
...   |
213 | |             }
214 | |         }
    | |_________^

error[E0311]: the parameter type `K` may not live long enough
    --> liballoc/btree/map.rs:1046:37
     |
1046 |             if let Internal(node) = node.force() {
     |                                     ^^^^
     |
     = help: consider adding an explicit lifetime bound for `K`
note: the parameter type `K` must be valid for the anonymous lifetime #1 defined on the function body at 1043:9...
    --> liballoc/btree/map.rs:1043:9
     |
1043 | /         fn dfs<K, V>(node: NodeRef<marker::Immut, K, V, marker::LeafOrInternal>) -> usize {
1044 | |             let mut res = node.len();
1045 | |
1046 | |             if let Internal(node) = node.force() {
...    |
1061 | |             res
1062 | |         }
     | |_________^

error[E0311]: the parameter type `V` may not live long enough
    --> liballoc/btree/map.rs:1046:37
     |
1046 |             if let Internal(node) = node.force() {
     |                                     ^^^^
     |
     = help: consider adding an explicit lifetime bound for `V`
note: the parameter type `V` must be valid for the anonymous lifetime #1 defined on the function body at 1043:9...
    --> liballoc/btree/map.rs:1043:9
     |
1043 | /         fn dfs<K, V>(node: NodeRef<marker::Immut, K, V, marker::LeafOrInternal>) -> usize {
1044 | |             let mut res = node.len();
1045 | |
1046 | |             if let Internal(node) = node.force() {
...    |
1061 | |             res
1062 | |         }
     | |_________^
@gsollazzo gsollazzo added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Feb 15, 2018
@nikomatsakis
Copy link
Contributor

This is a legit fix. I have a local patch.

@lqd lqd added the A-NLL Area: Non-lexical lifetimes (NLL) label Jun 29, 2018
@nikomatsakis nikomatsakis added this to the Rust 2018 Preview 2 milestone Jun 29, 2018
@nikomatsakis nikomatsakis self-assigned this Jun 29, 2018
@nikomatsakis nikomatsakis added NLL-fixed-by-NLL Bugs fixed, but only when NLL is enabled. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-compiler-nll and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 29, 2018
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 2, 2018
…reemap-annotations, r=gankro

add outlives annotations to `BTreeMap`

NLL requires these annotations, I believe because of <rust-lang#29149>.

Fixes rust-lang#48224

r? @gankro
cc @lqd
pietroalbini added a commit to pietroalbini/rust that referenced this issue Jul 3, 2018
…reemap-annotations, r=gankro

add outlives annotations to `BTreeMap`

NLL requires these annotations, I believe because of <rust-lang#29149>.

Fixes rust-lang#48224

r? @gankro
cc @lqd
pietroalbini added a commit to pietroalbini/rust that referenced this issue Jul 3, 2018
…reemap-annotations, r=gankro

add outlives annotations to `BTreeMap`

NLL requires these annotations, I believe because of <rust-lang#29149>.

Fixes rust-lang#48224

r? @gankro
cc @lqd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) C-bug Category: This is a bug. NLL-fixed-by-NLL Bugs fixed, but only when NLL is enabled. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants