Address PR comments

This commit is contained in:
Celina G. Val 2023-11-10 13:32:37 -08:00
parent 6515ac9d3f
commit 08036a8005
2 changed files with 3 additions and 4 deletions

View File

@ -327,8 +327,7 @@ impl<'tcx> Tables<'tcx> {
fn has_body(&self, instance: Instance<'tcx>) -> bool { fn has_body(&self, instance: Instance<'tcx>) -> bool {
let def_id = instance.def_id(); let def_id = instance.def_id();
!self.tcx.is_foreign_item(def_id) self.tcx.is_mir_available(def_id)
&& self.tcx.is_mir_available(def_id)
&& !matches!( && !matches!(
instance.def, instance.def,
ty::InstanceDef::Virtual(..) | ty::InstanceDef::Intrinsic(..) ty::InstanceDef::Virtual(..) | ty::InstanceDef::Intrinsic(..)

View File

@ -61,7 +61,7 @@ impl Instance {
with(|cx| cx.resolve_drop_in_place(ty)) with(|cx| cx.resolve_drop_in_place(ty))
} }
/// Resolve the drop in place for a given type. /// Resolve an instance for a given function pointer.
pub fn resolve_for_fn_ptr(def: FnDef, args: &GenericArgs) -> Result<Instance, crate::Error> { pub fn resolve_for_fn_ptr(def: FnDef, args: &GenericArgs) -> Result<Instance, crate::Error> {
with(|context| { with(|context| {
context.resolve_for_fn_ptr(def, args).ok_or_else(|| { context.resolve_for_fn_ptr(def, args).ok_or_else(|| {
@ -70,7 +70,7 @@ impl Instance {
}) })
} }
/// Resolve a closure (do we need kind? -- most cases use FnOnce) /// Resolve a closure with the expected kind.
pub fn resolve_closure( pub fn resolve_closure(
def: ClosureDef, def: ClosureDef,
args: &GenericArgs, args: &GenericArgs,