Skip to content

Nested method calls with &mut receivers result in borrowck errors #6268

Closed
@nikomatsakis

Description

@nikomatsakis

This is challenging to resolve. I thought I could fit into the new borrow checker, but it is worth addressing separately since there are a number of subtle issues. What this really amounts to is that you need to support borrows where the lifetime of the borrow pointer does not encompass the borrow itself. To handle this safely, we wind up with two loans, the primary one and then a secondary, aliasing loan that tracks the fact that a pointer has been created, even if the memory it points at cannot be dereferenced yet.

Part of #5074

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions