Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make stable_mir::with_tables sound #120128

Merged
merged 4 commits into from
Jan 22, 2024
Merged

Commits on Jan 19, 2024

  1. Fix a soundness bug in with_tables.

    We were able to uplift any value from `Tables` to `'static`, which is unsound.
    oli-obk committed Jan 19, 2024
    Configuration menu
    Copy the full SHA
    06a9dbe View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    61361c1 View commit details
    Browse the repository at this point in the history
  3. Ensure internal function is safe

    The internal function was unsound, it could cause UB in rare cases where
    the user inadvertly stored the returned object in a location that could
    outlive the TyCtxt.
    
    In order to make it safe, we now take a type context as an argument to
    the internal fn, and we ensure that interned items are lifted using the
    provided context.
    
    Thus, this change ensures that the compiler can properly enforce
    that the object does not outlive the type context it was lifted to.
    celinval authored and oli-obk committed Jan 19, 2024
    Configuration menu
    Copy the full SHA
    9aace67 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6cd6539 View commit details
    Browse the repository at this point in the history