Skip to content

Borrow checker is unsound in the presence of mutable fields #5397

Closed

Description

@nikomatsakis

The current rules are not really sound. It will permit e.g. an &mut pointer to be created for a mut field found in an &T, which is aliasable. This is bad because the &mut pointer may not be the only pointer to that data.

The rewritten version I am trying to land as part of #5074 includes a fix but it's commented out because it causes compile errors in io.rs. Fixing those errors requires cleaning up object types and converting things to &mut self and I didn't want to block #5074 on those changes. (Hence this follow-on bug)

Activity

  1. nikomatsakis commented on May 17, 2013

    @nikomatsakis
    ContributorAuthor

    Since mutable fields have been removed, this is a moot point.

  2. added a commit that references this issue on May 2, 2020
  3. added a commit that references this issue on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesA-type-systemE-hard

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions