Skip to content

Building alloc fails since nightly 2022-06-17 #104

Closed
@phil-opp

Description

@phil-opp

The following error occurs:

error[E0502]: cannot borrow `map.root` as mutable because it is also borrowed as immutable
   --> /home/philipp/.rustup/toolchains/bisector-ci-1b9daa69640970e7858b7c8e1c9f72c604985e11-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/collections/btree/map.rs:295:25
    |
295 |         let root_node = map.root.get_or_insert_with(|| Root::new(&*map.alloc)).borrow_mut();
    |                         ^^^^^^^^^------------------^--^^^^^^^^^^^^^---------^^
    |                         |        |                  |              |
    |                         |        |                  |              first borrow occurs due to use of `map` in closure
    |                         |        |                  immutable borrow occurs here
    |                         |        immutable borrow later used by call
    |                         mutable borrow occurs here

error[E0502]: cannot borrow `self.root` as mutable because it is also borrowed as immutable
    --> /home/philipp/.rustup/toolchains/bisector-ci-1b9daa69640970e7858b7c8e1c9f72c604985e11-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/collections/btree/map.rs:1112:20
     |
1112 |         let root = self.root.get_or_insert_with(|| Root::new(&*self.alloc));
     |                    ^^^^^^^^^^------------------^--^^^^^^^^^^^^^----------^^
     |                    |         |                  |              |
     |                    |         |                  |              first borrow occurs due to use of `self` in closure
     |                    |         |                  immutable borrow occurs here
     |                    |         immutable borrow later used by call
     |                    mutable borrow occurs here

The cargo bisect-rustc tool points to this commit: rust-lang/rust@1b9daa6

The error does not happen with cargo's own -Zbuild-std, so it must depend on the build command somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions