mir: Ignore noop casts (e.g. when as used for coercion).
This commit is contained in:
parent
1de6a9682f
commit
ccc5e0732a
1 changed files with 7 additions and 2 deletions
|
|
@ -73,8 +73,13 @@ impl<'a,'tcx> Builder<'a,'tcx> {
|
|||
})
|
||||
}
|
||||
ExprKind::Cast { source } => {
|
||||
let source = unpack!(block = this.as_operand(block, source));
|
||||
block.and(Rvalue::Cast(CastKind::Misc, source, expr.ty))
|
||||
let source = this.hir.mirror(source);
|
||||
if source.ty == expr.ty {
|
||||
this.expr_as_rvalue(block, source)
|
||||
} else {
|
||||
let source = unpack!(block = this.as_operand(block, source));
|
||||
block.and(Rvalue::Cast(CastKind::Misc, source, expr.ty))
|
||||
}
|
||||
}
|
||||
ExprKind::ReifyFnPointer { source } => {
|
||||
let source = unpack!(block = this.as_operand(block, source));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue