Skip to content

NLL / MIR-borrowck regression in liballoc #48224

Closed
@Aaron1011

Description

@Aaron1011

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 | |         }
     | |_________^

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.fixed-by-NLLBugs fixed, but only when NLL is enabled.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions