-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
[MIR] Handle coercion casts properly when building the MIR #33303
Conversation
Coercion casts (`expr as T` where the type of `expr` can be coerced to `T`) are essentially no-ops, as the actual work is done by a coercion. Previously a check for type equality was used to avoid emitting the redundant cast in the MIR, but this failed for coercion casts of function items that had lifetime parameters. The MIR trans code doesn't handle `FnPtr -> FnPtr` casts and produced an error. Also fixes a bug with type ascription expressions not having any adjustments applied. Fixes rust-lang#33295
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 3906aef has been approved by |
[MIR] Handle coercion casts properly when building the MIR Coercion casts (`expr as T` where the type of `expr` can be coerced to `T`) are essentially no-ops, as the actual work is done by a coercion. Previously a check for type equality was used to avoid emitting the redundant cast in the MIR, but this failed for coercion casts of function items that had lifetime parameters. The MIR trans code doesn't handle `FnPtr -> FnPtr` casts and produced an error. Also fixes a bug with type ascription expressions not having any adjustments applied. Fixes #33295 /cc @eddyb
💔 Test failed - auto-mac-64-opt-rustbuild |
@alexcrichton @bors retry |
💔 Test failed - auto-win-msvc-32-opt |
What the **** - cc @nikomatsakis @michaelwoerister @bors retry |
💔 Test failed - auto-linux-64-opt-mir |
@bors retry |
💔 Test failed - auto-win-msvc-64-opt-mir |
@bors: retry On Sun, May 1, 2016 at 10:46 AM, bors [email protected] wrote:
|
Spurious because of #31657 |
[MIR] Handle coercion casts properly when building the MIR Coercion casts (`expr as T` where the type of `expr` can be coerced to `T`) are essentially no-ops, as the actual work is done by a coercion. Previously a check for type equality was used to avoid emitting the redundant cast in the MIR, but this failed for coercion casts of function items that had lifetime parameters. The MIR trans code doesn't handle `FnPtr -> FnPtr` casts and produced an error. Also fixes a bug with type ascription expressions not having any adjustments applied. Fixes #33295 /cc @eddyb
Coercion casts (
expr as T
where the type ofexpr
can be coerced toT
) are essentially no-ops, as the actual work is done by a coercion.Previously a check for type equality was used to avoid emitting the
redundant cast in the MIR, but this failed for coercion casts of
function items that had lifetime parameters. The MIR trans code doesn't
handle
FnPtr -> FnPtr
casts and produced an error.Also fixes a bug with type ascription expressions not having any
adjustments applied.
Fixes #33295
/cc @eddyb