Skip to content

Commit 116e43f

Browse files
MaikKleinarielb1
authored andcommitted
Prefer type_of().substs over instance::ty()
1 parent 282b231 commit 116e43f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/librustc_trans/debuginfo/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use llvm;
2424
use llvm::{ModuleRef, ContextRef, ValueRef};
2525
use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilderRef, DISubprogram, DIArray, DIFlags};
2626
use rustc::hir::def_id::{DefId, CrateNum};
27-
use rustc::ty::subst::Substs;
27+
use rustc::ty::subst::{Subst, Substs};
2828

2929
use abi::Abi;
3030
use common::CrateContext;
@@ -428,7 +428,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
428428
// If the method does *not* belong to a trait, proceed
429429
if cx.tcx().trait_id_of_impl(impl_def_id).is_none() {
430430
let impl_self_ty =
431-
Instance::new(impl_def_id, instance.substs).ty(cx.tcx());
431+
cx.tcx().type_of(impl_def_id).subst(cx.tcx(), instance.substs);
432432

433433
// Only "class" methods are generally understood by LLVM,
434434
// so avoid methods on other types (e.g. `<*mut T>::null`).

src/librustc_trans/partitioning.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ use std::collections::hash_map::Entry;
114114
use syntax::ast::NodeId;
115115
use syntax::symbol::{Symbol, InternedString};
116116
use trans_item::{MonoItem, BaseMonoItemExt, MonoItemExt, InstantiationMode};
117-
use rustc::ty::Instance;
117+
use rustc::ty::subst::Subst;
118118

119119
pub use rustc::mir::mono::CodegenUnit;
120120

@@ -575,7 +575,7 @@ fn characteristic_def_id_of_trans_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
575575
if let Some(impl_def_id) = tcx.impl_of_method(def_id) {
576576
// This is a method within an inherent impl, find out what the
577577
// self-type is:
578-
let impl_self_ty = Instance::new(impl_def_id, instance.substs).ty(tcx);
578+
let impl_self_ty = tcx.type_of(impl_def_id).subst(tcx, instance.substs);
579579
if let Some(def_id) = characteristic_def_id_of_type(impl_self_ty) {
580580
return Some(def_id);
581581
}

0 commit comments

Comments
 (0)