-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make stable_mir::with_tables sound #120128
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We were able to uplift any value from `Tables` to `'static`, which is unsound.
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.
This comment has been minimized.
This comment has been minimized.
c1b5e76
to
6cd6539
Compare
@bors r+ rollup |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 21, 2024
…nval Make stable_mir::with_tables sound See the first commit for the actual soundness fix. The rest is just fallout from that and is entirely safe code. Includes most of rust-lang#120120 The major difference to rust-lang#120120 is that we don't need an unsafe trait, as we can now rely on the type system (the only unsafe part, and the actual source of the unsoundness was in `with_tables`) r? `@celinval`
This was referenced Jan 21, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 21, 2024
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120005 (Update Readme) - rust-lang#120045 (Un-hide `iter::repeat_n`) - rust-lang#120128 (Make stable_mir::with_tables sound) - rust-lang#120145 (fix: Drop guard was deallocating with the incorrect size) - rust-lang#120158 (`rustc_mir_dataflow`: Restore removed exports) - rust-lang#120167 (Capture the rationale for `-Zallow-features=` in bootstrap.py) - rust-lang#120174 (Warn users about limited review for tier 2 and 3 code) - rust-lang#120180 (Document some alternatives to `Vec::split_off`) Failed merges: - rust-lang#120171 (Fix assume and assert in jump threading) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 21, 2024
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120005 (Update Readme) - rust-lang#120045 (Un-hide `iter::repeat_n`) - rust-lang#120128 (Make stable_mir::with_tables sound) - rust-lang#120145 (fix: Drop guard was deallocating with the incorrect size) - rust-lang#120158 (`rustc_mir_dataflow`: Restore removed exports) - rust-lang#120167 (Capture the rationale for `-Zallow-features=` in bootstrap.py) - rust-lang#120174 (Warn users about limited review for tier 2 and 3 code) - rust-lang#120180 (Document some alternatives to `Vec::split_off`) Failed merges: - rust-lang#120171 (Fix assume and assert in jump threading) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 21, 2024
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120005 (Update Readme) - rust-lang#120045 (Un-hide `iter::repeat_n`) - rust-lang#120128 (Make stable_mir::with_tables sound) - rust-lang#120145 (fix: Drop guard was deallocating with the incorrect size) - rust-lang#120158 (`rustc_mir_dataflow`: Restore removed exports) - rust-lang#120167 (Capture the rationale for `-Zallow-features=` in bootstrap.py) - rust-lang#120174 (Warn users about limited review for tier 2 and 3 code) - rust-lang#120180 (Document some alternatives to `Vec::split_off`) Failed merges: - rust-lang#120171 (Fix assume and assert in jump threading) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 21, 2024
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120005 (Update Readme) - rust-lang#120045 (Un-hide `iter::repeat_n`) - rust-lang#120128 (Make stable_mir::with_tables sound) - rust-lang#120145 (fix: Drop guard was deallocating with the incorrect size) - rust-lang#120158 (`rustc_mir_dataflow`: Restore removed exports) - rust-lang#120167 (Capture the rationale for `-Zallow-features=` in bootstrap.py) - rust-lang#120174 (Warn users about limited review for tier 2 and 3 code) - rust-lang#120180 (Document some alternatives to `Vec::split_off`) Failed merges: - rust-lang#120171 (Fix assume and assert in jump threading) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 22, 2024
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120005 (Update Readme) - rust-lang#120045 (Un-hide `iter::repeat_n`) - rust-lang#120128 (Make stable_mir::with_tables sound) - rust-lang#120145 (fix: Drop guard was deallocating with the incorrect size) - rust-lang#120158 (`rustc_mir_dataflow`: Restore removed exports) - rust-lang#120167 (Capture the rationale for `-Zallow-features=` in bootstrap.py) - rust-lang#120174 (Warn users about limited review for tier 2 and 3 code) - rust-lang#120180 (Document some alternatives to `Vec::split_off`) Failed merges: - rust-lang#120171 (Fix assume and assert in jump threading) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 22, 2024
Rollup merge of rust-lang#120128 - oli-obk:smir_internal_lift, r=celinval Make stable_mir::with_tables sound See the first commit for the actual soundness fix. The rest is just fallout from that and is entirely safe code. Includes most of rust-lang#120120 The major difference to rust-lang#120120 is that we don't need an unsafe trait, as we can now rely on the type system (the only unsafe part, and the actual source of the unsoundness was in `with_tables`) r? `@celinval`
celinval
added a commit
to celinval/kani-dev
that referenced
this pull request
Jan 24, 2024
- This is due to the safety fix to the internal function, which was done here: rust-lang/rust#120128
feliperodri
added a commit
to model-checking/kani
that referenced
this pull request
Feb 8, 2024
Related PRs so far: - rust-lang/rust#119869 - rust-lang/rust#120080 - rust-lang/rust#120128 - rust-lang/rust#119369 - rust-lang/rust#116672 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Signed-off-by: Felipe R. Monteiro <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: tautschnig <[email protected]> Co-authored-by: Qinheping Hu <[email protected]> Co-authored-by: Michael Tautschnig <[email protected]> Co-authored-by: Felipe R. Monteiro <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See the first commit for the actual soundness fix. The rest is just fallout from that and is entirely safe code. Includes most of #120120
The major difference to #120120 is that we don't need an unsafe trait, as we can now rely on the type system (the only unsafe part, and the actual source of the unsoundness was in
with_tables
)r? @celinval