Skip to content

Commit 2564199

Browse files
trans: Make meth::get_vtable_methods() not depend on CrateContext.
1 parent 100a4f5 commit 2564199

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/librustc_trans/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ fn create_trans_items_for_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
10081008
impl_def_id,
10091009
substs,
10101010
nested: _ }) => {
1011-
let items = meth::get_vtable_methods(ccx, impl_def_id, substs)
1011+
let items = meth::get_vtable_methods(ccx.tcx(), impl_def_id, substs)
10121012
.into_iter()
10131013
// filter out None values
10141014
.filter_map(|opt_impl_method| opt_impl_method)

src/librustc_trans/meth.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
157157
substs,
158158
nested: _ }) => {
159159
let nullptr = C_null(Type::nil(ccx).ptr_to());
160-
get_vtable_methods(ccx, id, substs)
160+
get_vtable_methods(tcx, id, substs)
161161
.into_iter()
162162
.map(|opt_mth| opt_mth.map_or(nullptr, |mth| {
163163
Callee::def(ccx, mth.method.def_id, &mth.substs).reify(ccx).val
@@ -215,13 +215,11 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
215215
vtable
216216
}
217217

218-
pub fn get_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
219-
impl_id: DefId,
220-
substs: &'tcx subst::Substs<'tcx>)
221-
-> Vec<Option<ImplMethod<'tcx>>>
218+
pub fn get_vtable_methods<'tcx>(tcx: &TyCtxt<'tcx>,
219+
impl_id: DefId,
220+
substs: &'tcx subst::Substs<'tcx>)
221+
-> Vec<Option<ImplMethod<'tcx>>>
222222
{
223-
let tcx = ccx.tcx();
224-
225223
debug!("get_vtable_methods(impl_id={:?}, substs={:?}", impl_id, substs);
226224

227225
let trt_id = match tcx.impl_trait_ref(impl_id) {

0 commit comments

Comments
 (0)