-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Pass the right ParamEnv
to might_permit_raw_init_strict
#128720
Conversation
rustbot has assigned @petrochenkov. Use |
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me.
@bors r+ rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#128369 (rustc_lint: make `let-underscore-lock` translatable) - rust-lang#128377 (Fix ICE Caused by Incorrectly Delaying E0107) - rust-lang#128517 (Fallback to string formatting if source is not available for lint) - rust-lang#128685 (Remove the root Cargo.lock from the rust-src component) - rust-lang#128693 (rustdoc-search: account for numeric disambiguators on impls) - rust-lang#128720 (Pass the right `ParamEnv` to `might_permit_raw_init_strict`) - rust-lang#128736 (Fix rustdoc missing handling of remap-path-prefix option) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128720 - y21:issue119620, r=compiler-errors Pass the right `ParamEnv` to `might_permit_raw_init_strict` Fixes rust-lang#119620 `might_permit_raw_init_strict` currently passes an empty `ParamEnv` to the `InterpCx`, instead of the actual `ParamEnv` that was passed in to `check_validity_requirement` at callsite. This leads to ICEs such as the linked issue where for `UnsafeCell<*mut T>` we initially get the layout with the right `ParamEnv` (which suceeds because it can prove that `T: Sized` and therefore `UnsafeCell<*mut T>` has a known layout) but then do the rest with an empty `ParamEnv` where `T: Sized` is not known to hold so getting the layout for `*mut T` later fails. This runs into an assertion in other layout code where it's making the (valid) assumption that, when we already have a layout for a struct (`UnsafeCell<*mut T>`), getting the layout of one of its fields (`*mut T`) should also succeed, which wasn't the case here due to using the wrong `ParamEnv`. So, this PR changes it to just use the same `ParamEnv` all the way throughout.
Rustup r? `@ghost` changelog: ICE fix [`uninit_vec`] through rust-lang/rust#128720
Fixes #119620
might_permit_raw_init_strict
currently passes an emptyParamEnv
to theInterpCx
, instead of the actualParamEnv
that was passed in tocheck_validity_requirement
at callsite.This leads to ICEs such as the linked issue where for
UnsafeCell<*mut T>
we initially get the layout with the rightParamEnv
(which suceeds because it can prove thatT: Sized
and thereforeUnsafeCell<*mut T>
has a known layout) but then do the rest with an emptyParamEnv
whereT: Sized
is not known to hold so getting the layout for*mut T
later fails.This runs into an assertion in other layout code where it's making the (valid) assumption that, when we already have a layout for a struct (
UnsafeCell<*mut T>
), getting the layout of one of its fields (*mut T
) should also succeed, which wasn't the case here due to using the wrongParamEnv
.So, this PR changes it to just use the same
ParamEnv
all the way throughout.