-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 unsized casts illegal #116056
Make unsized casts illegal #116056
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
@@ -725,6 +725,9 @@ impl<'a, 'tcx> CastCheck<'tcx> { | |||
}, | |||
// array-ptr-cast | |||
Ptr(mt) => { | |||
if !mt.ty.is_sized(fcx.tcx, fcx.param_env) { |
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.
This type may have region variables. That'll cause an ICE. Try using:
if !mt.ty.is_sized(fcx.tcx, fcx.param_env) { | |
if !fcx.type_is_sized_modulo_regions(fcx.param_env, mt.ty) { |
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.
Thanks! Didn't know this.
please squash this into one commit |
@bors r+ |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#115770 (Match on elem first while building move paths) - rust-lang#115999 (Capture scrutinee of if let guards correctly) - rust-lang#116056 (Make unsized casts illegal) - rust-lang#116061 (Remove TaKO8Ki from review rotation) - rust-lang#116062 (Change `start` to `#[start]` in some diagnosis) - rust-lang#116067 (Open the FileEncoder file for reading and writing) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#116056 - ouz-a:wide_ice, r=compiler-errors Make unsized casts illegal Weirdly enough this rust-lang#115998 issue seems to exist since Rust 1.0 (couldn't check before that) but it's only recently been noticed. This change makes those casts illegal. Fixes rust-lang#115998
Weirdly enough this #115998 issue seems to exist since Rust 1.0 (couldn't check before that) but it's only recently been noticed. This change makes those casts illegal.
Fixes #115998