Rollup merge of #120778 - zetanumbers:refactor_try_instance_mir, r=compiler-errors
Deduplicate `tcx.instance_mir(instance)` calls in `try_instance_mir`
This commit is contained in:
commit
3e523f6d3c
@ -1027,9 +1027,9 @@ fn try_instance_mir<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
instance: InstanceDef<'tcx>,
|
||||
) -> Result<&'tcx Body<'tcx>, &'static str> {
|
||||
match instance {
|
||||
ty::InstanceDef::DropGlue(_, Some(ty)) => match ty.kind() {
|
||||
ty::Adt(def, args) => {
|
||||
if let ty::InstanceDef::DropGlue(_, Some(ty)) = instance
|
||||
&& let ty::Adt(def, args) = ty.kind()
|
||||
{
|
||||
let fields = def.all_fields();
|
||||
for field in fields {
|
||||
let field_ty = field.ty(tcx, args);
|
||||
@ -1037,11 +1037,6 @@ fn try_instance_mir<'tcx>(
|
||||
return Err("cannot build drop shim for polymorphic type");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Ok(tcx.instance_mir(instance))
|
||||
}
|
||||
_ => Ok(tcx.instance_mir(instance)),
|
||||
},
|
||||
_ => Ok(tcx.instance_mir(instance)),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user