Skip to content

Fix of a borrow checking soundness bug that exists on stable #51271

@golddranks

Description

@golddranks

My code apparently used to rely (accidentally) on a soundness bug on the borrow checker. Compile this on 1.26.1 (and 1.26) and it runs; compile on a nightly newer than 524ad9b9e 2018-05-30 and it errors. It's a good thing that this got fixed, but I couldn't find the commit that fixed it right away. Is this a known fix for a known problem?

A minimized example: https://play.rust-lang.org/?gist=30a66d680ee0b69bbadb2c83f7ccb27f&version=stable&mode=debug

I was able to create a segfault on 1.26.1 by mutating the borrowed value: https://play.rust-lang.org/?gist=02f748c8c4fd56af77f77961eae11d48&version=stable&mode=debug

(The original code was something like this)
https://play.rust-lang.org/?gist=d0b21febdd80775ebe280fb6e7bd5f30&version=stable&mode=debug

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