Enable instcombine for mutable reborrows
This commit is contained in:
parent
4b34c7b766
commit
1409cb59b2
4 changed files with 9 additions and 31 deletions
|
@ -110,11 +110,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> {
|
|||
fn combine_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
||||
if let Rvalue::Ref(_, _, place) = rvalue {
|
||||
if let Some((base, ProjectionElem::Deref)) = place.as_ref().last_projection() {
|
||||
if let ty::Ref(_, _, Mutability::Not) =
|
||||
base.ty(self.local_decls, self.tcx).ty.kind()
|
||||
{
|
||||
// The dereferenced place must have type `&_`, so that we don't copy `&mut _`.
|
||||
} else {
|
||||
if rvalue.ty(self.local_decls, self.tcx) != base.ty(self.local_decls, self.tcx).ty {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue