Skip to content

Commit d5bf25c

Browse files
committed
Alt fix
1 parent 31bb8d2 commit d5bf25c

File tree

1 file changed

+3
-34
lines changed
  • compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi

1 file changed

+3
-34
lines changed

compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use rustc_hir as hir;
1010
use rustc_hir::LangItem;
1111
use rustc_middle::bug;
1212
use rustc_middle::ty::{
13-
self, ExistentialPredicateStableCmpExt as _, Instance, InstanceKind, IntTy, List, TraitRef, Ty,
14-
TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt, UintTy,
13+
self, ExistentialPredicateStableCmpExt as _, Instance, IntTy, List, TraitRef, Ty, TyCtxt,
14+
TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt, UintTy,
1515
};
1616
use rustc_span::def_id::DefId;
1717
use rustc_span::{DUMMY_SP, sym};
@@ -453,35 +453,6 @@ pub(crate) fn transform_instance<'tcx>(
453453
instance.def = ty::InstanceKind::Virtual(call, 0);
454454
instance.args = abstract_args;
455455
}
456-
let fn_traits = [
457-
(LangItem::Fn, sym::call),
458-
(LangItem::FnMut, sym::call_mut),
459-
(LangItem::FnOnce, sym::call_once),
460-
];
461-
for (lang_item, method_sym) in fn_traits {
462-
if let Some(trait_id) = tcx.lang_items().get(lang_item) {
463-
let items = tcx.associated_items(trait_id);
464-
if let Some(call_method) =
465-
items.in_definition_order().find(|item| item.name() == method_sym)
466-
{
467-
if instance.def_id() == call_method.def_id {
468-
// This is a call to a method of Fn, FnMut, or FnOnce. Transform self into a
469-
// trait object of the trait that defines the method.
470-
let self_ty = trait_object_ty(
471-
tcx,
472-
ty::Binder::dummy(ty::TraitRef::from_method(
473-
tcx,
474-
trait_id,
475-
instance.args,
476-
)),
477-
);
478-
instance.args =
479-
tcx.mk_args_trait(self_ty, instance.args.into_iter().skip(1));
480-
break;
481-
}
482-
}
483-
}
484-
}
485456
}
486457

487458
instance
@@ -503,9 +474,7 @@ fn implemented_method<'tcx>(
503474
trait_method = tcx.associated_item(method_id);
504475
trait_id = trait_ref.skip_binder().def_id;
505476
impl_id
506-
} else if let InstanceKind::Item(def_id) = instance.def
507-
&& let Some(trait_method_bound) = tcx.opt_associated_item(def_id)
508-
{
477+
} else if let Some(trait_method_bound) = tcx.opt_associated_item(instance.def_id()) {
509478
// Provided method in a `trait` block
510479
trait_method = trait_method_bound;
511480
method_id = instance.def_id();

0 commit comments

Comments
 (0)