Skip to content

ICE in borrow checker #27480

Closed
Closed
@eefriedman

Description

@eefriedman

https://play.rust-lang.org/?gist=23de822c03921663ae66&version=nightly .

Error message:

<anon>:110:25: 110:60 error: cannot assign to `*entry` because it is borrowed
<anon>:110                         *entry = FragmentRepr::Enum(discrs);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: in expansion of if let expansion
<anon>:108:21: 111:22 note: expansion site
note: in expansion of for loop expansion
<anon>:100:5: 150:6 note: expansion site
<anon>:112:64: 112:78 note: borrow of `*entry` occurs here
<anon>:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
<anon>:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
<anon>:100:5: 150:6 note: expansion site
<anon>:112:64: 112:78 error: cannot borrow `entry.0` as mutable more than once at a time
<anon>:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
<anon>:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
<anon>:100:5: 150:6 note: expansion site
<anon>:112:64: 112:78 note: previous borrow of `entry.0` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `entry.0` until the borrow ends
<anon>:112                     let mut discrs = if let FragmentRepr::Enum(ref mut discrs) = *entry {
                                                                          ^~~~~~~~~~~~~~
note: in expansion of if let expansion
<anon>:112:38: 116:22 note: expansion site
note: in expansion of for loop expansion
<anon>:100:5: 150:6 note: expansion site
<anon>:150:6: 150:6 note: previous borrow ends here
<anon>:100     for &move_path_index in paths {
...
<anon>:150     }
               ^
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: `(left == right)` (left: `collections::vec::Vec<(u32, FragmentRepr)>`, right: `Box<FragmentRepr>`)', ../src/librustc_borrowck/borrowck/mod.rs:454

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions