Prefer type_of().substs over instance::ty()
This commit is contained in:
parent
282b231af2
commit
116e43f73b
2 changed files with 4 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ use llvm;
|
|||
use llvm::{ModuleRef, ContextRef, ValueRef};
|
||||
use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilderRef, DISubprogram, DIArray, DIFlags};
|
||||
use rustc::hir::def_id::{DefId, CrateNum};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::subst::{Subst, Substs};
|
||||
|
||||
use abi::Abi;
|
||||
use common::CrateContext;
|
||||
|
|
@ -428,7 +428,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
// If the method does *not* belong to a trait, proceed
|
||||
if cx.tcx().trait_id_of_impl(impl_def_id).is_none() {
|
||||
let impl_self_ty =
|
||||
Instance::new(impl_def_id, instance.substs).ty(cx.tcx());
|
||||
cx.tcx().type_of(impl_def_id).subst(cx.tcx(), instance.substs);
|
||||
|
||||
// Only "class" methods are generally understood by LLVM,
|
||||
// so avoid methods on other types (e.g. `<*mut T>::null`).
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ use std::collections::hash_map::Entry;
|
|||
use syntax::ast::NodeId;
|
||||
use syntax::symbol::{Symbol, InternedString};
|
||||
use trans_item::{MonoItem, BaseMonoItemExt, MonoItemExt, InstantiationMode};
|
||||
use rustc::ty::Instance;
|
||||
use rustc::ty::subst::Subst;
|
||||
|
||||
pub use rustc::mir::mono::CodegenUnit;
|
||||
|
||||
|
|
@ -575,7 +575,7 @@ fn characteristic_def_id_of_trans_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
if let Some(impl_def_id) = tcx.impl_of_method(def_id) {
|
||||
// This is a method within an inherent impl, find out what the
|
||||
// self-type is:
|
||||
let impl_self_ty = Instance::new(impl_def_id, instance.substs).ty(tcx);
|
||||
let impl_self_ty = tcx.type_of(impl_def_id).subst(tcx, instance.substs);
|
||||
if let Some(def_id) = characteristic_def_id_of_type(impl_self_ty) {
|
||||
return Some(def_id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue