Allow checking whether a type allows being uninitialized#108669
Merged
bors merged 1 commit intorust-lang:masterfrom Mar 4, 2023
Merged
Allow checking whether a type allows being uninitialized#108669bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
This is useful for clippy and for the future `MaybeUninit::assume_init` panics.
Collaborator
|
r? @wesleywiser (rustbot has picked a reviewer for you, use r? to override) |
Collaborator
|
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
Contributor
|
@Nilstrieb told me that he was gonna use this in clippy/add usages in a follow-up @bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 4, 2023
Rollup of 6 pull requests Successful merges: - rust-lang#108298 (Fix ICE: check if snippet is `)`) - rust-lang#108405 (Lazily compute crate name for consider_optimizing) - rust-lang#108656 (Rustdoc search: Emit an error for unclosed generic) - rust-lang#108660 (Remove ne implementations from strings) - rust-lang#108669 (Allow checking whether a type allows being uninitialized) - rust-lang#108727 (rustc_expand: make proc-macro derive error translatable) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang/rust-clippy
that referenced
this pull request
Mar 21, 2023
Use uninit checking from rustc rustc has proper heuristics for actually checking whether a type allows being left uninitialized (by asking CTFE). We can now use this for our helper instead of rolling our own bad version with false positives. I added this in rustc in rust-lang/rust#108669 Fix #10407 changelog: [`uninit_vec`]: fix false positives changelog: [`uninit_assumed_init`]: fix false positives
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is useful for clippy (rust-lang/clippy#10407) and for the future
MaybeUninit::assume_initpanics (#100423).