]> git.lizzy.rs Git - rust.git/commit
Auto merge of #33303 - Aatch:mir-coercion-cast, r=arielb1
authorbors <bors@rust-lang.org>
Mon, 2 May 2016 13:58:11 +0000 (06:58 -0700)
committerbors <bors@rust-lang.org>
Mon, 2 May 2016 13:58:11 +0000 (06:58 -0700)
commit0eb575c702f56735d8bc6c3d76cb4d9bdeb13e84
treebb0c0f392548a68d376211883cb4d09a91c9ef98
parente1a575cb077d2070cc4527fa43bf9ef790f89f04
parent3906aef5c6df5a6d71d0a6b0c9c816b9160f9de1
Auto merge of #33303 - Aatch:mir-coercion-cast, r=arielb1

[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