Skip to content

Commit 33caf0b

Browse files
committed
Rename Instance.ty to Instance.monomorphic_ty
1 parent 464b58c commit 33caf0b

File tree

9 files changed

+13
-16
lines changed

9 files changed

+13
-16
lines changed

src/librustc/ty/instance.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,13 @@ impl<'tcx> Instance<'tcx> {
7373
/// (e.g. when we are attempting to to do const-propagation).
7474
/// In this case, `Instace.ty_env` should be used to provide
7575
/// the `ParamEnv` for our generic context.
76-
pub fn ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
76+
pub fn monomorphic_ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
7777
let ty = tcx.type_of(self.def.def_id());
7878
// There shouldn't be any params - if there are, then
7979
// Instance.ty_env should have been used to provide the proper
8080
// ParamEnv
8181
if self.substs.has_param_types() {
82-
bug!(
83-
"Instance.ty called for type {:?} with params in substs: {:?}",
84-
ty,
85-
self.substs
86-
);
82+
bug!("Instance.ty called for type {:?} with params in substs: {:?}", ty, self.substs);
8783
}
8884
tcx.subst_and_normalize_erasing_regions(self.substs, ty::ParamEnv::reveal_all(), &ty)
8985
}

src/librustc/ty/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ impl<'tcx> ty::Instance<'tcx> {
23012301
// or should go through `FnAbi` instead, to avoid losing any
23022302
// adjustments `FnAbi::of_instance` might be performing.
23032303
fn fn_sig_for_fn_abi(&self, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> {
2304-
let ty = self.ty(tcx);
2304+
let ty = self.monomorphic_ty(tcx);
23052305
match ty.kind {
23062306
ty::FnDef(..) |
23072307
// Shims currently have type FnPtr. Not sure this should remain.

src/librustc_codegen_llvm/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub fn get_fn(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) -> &'ll Value
3636
}
3737

3838
let sym = tcx.symbol_name(instance).name.as_str();
39-
debug!("get_fn({:?}: {:?}) => {}", instance, instance.ty(cx.tcx()), sym);
39+
debug!("get_fn({:?}: {:?}) => {}", instance, instance.monomorphic_ty(cx.tcx()), sym);
4040

4141
let fn_abi = FnAbi::of_instance(cx, instance, &[]);
4242

src/librustc_codegen_llvm/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl CodegenCx<'ll, 'tcx> {
204204
def_id
205205
);
206206

207-
let ty = instance.ty(self.tcx);
207+
let ty = instance.monomorphic_ty(self.tcx);
208208
let sym = self.tcx.symbol_name(instance).name;
209209

210210
debug!("get_static: sym={} instance={:?}", sym, instance);
@@ -361,7 +361,7 @@ impl StaticMethods for CodegenCx<'ll, 'tcx> {
361361
};
362362

363363
let instance = Instance::mono(self.tcx, def_id);
364-
let ty = instance.ty(self.tcx);
364+
let ty = instance.monomorphic_ty(self.tcx);
365365
let llty = self.layout_of(ty).llvm_type(self);
366366
let g = if val_llty == llty {
367367
g

src/librustc_codegen_llvm/debuginfo/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2287,7 +2287,7 @@ pub fn create_global_var_metadata(cx: &CodegenCx<'ll, '_>, def_id: DefId, global
22872287
};
22882288

22892289
let is_local_to_unit = is_node_local_to_unit(cx, def_id);
2290-
let variable_type = Instance::mono(cx.tcx, def_id).ty(cx.tcx);
2290+
let variable_type = Instance::mono(cx.tcx, def_id).monomorphic_ty(cx.tcx);
22912291
let type_metadata = type_metadata(cx, variable_type, span);
22922292
let var_name = SmallCStr::new(&tcx.item_name(def_id).as_str());
22932293
let linkage_name = if no_mangle {

src/librustc_codegen_llvm/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
8989
span: Span,
9090
) {
9191
let tcx = self.tcx;
92-
let callee_ty = instance.ty(tcx);
92+
let callee_ty = instance.monomorphic_ty(tcx);
9393

9494
let (def_id, substs) = match callee_ty.kind {
9595
ty::FnDef(def_id, substs) => (def_id, substs),

src/librustc_codegen_llvm/mono_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> {
2222
symbol_name: &str,
2323
) {
2424
let instance = Instance::mono(self.tcx, def_id);
25-
let ty = instance.ty(self.tcx);
25+
let ty = instance.monomorphic_ty(self.tcx);
2626
let llty = self.layout_of(ty).llvm_type(self);
2727

2828
let g = self.define_global(symbol_name, llty).unwrap_or_else(|| {

src/librustc_mir/interpret/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
140140
// to determine the type.
141141
let drop_instance = self.memory.get_fn(drop_fn)?.as_instance()?;
142142
trace!("Found drop fn: {:?}", drop_instance);
143-
let fn_sig = drop_instance.ty(*self.tcx).fn_sig(*self.tcx);
143+
let fn_sig = drop_instance.monomorphic_ty(*self.tcx).fn_sig(*self.tcx);
144144
let fn_sig = self.tcx.normalize_erasing_late_bound_regions(self.param_env, &fn_sig);
145145
// The drop function takes `*mut T` where `T` is the type being dropped, so get that.
146146
let args = fn_sig.inputs();

src/librustc_mir/monomorphize/collector.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ fn collect_items_rec<'tcx>(
358358
// Sanity check whether this ended up being collected accidentally
359359
debug_assert!(should_monomorphize_locally(tcx, &instance));
360360

361-
let ty = instance.ty(tcx);
361+
let ty = instance.monomorphic_ty(tcx);
362362
visit_drop_use(tcx, ty, true, &mut neighbors);
363363

364364
recursion_depth_reset = None;
@@ -1002,7 +1002,8 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
10021002
def_id_to_string(self.tcx, def_id)
10031003
);
10041004

1005-
let ty = Instance::new(def_id, InternalSubsts::empty()).ty(self.tcx);
1005+
let ty =
1006+
Instance::new(def_id, InternalSubsts::empty()).monomorphic_ty(self.tcx);
10061007
visit_drop_use(self.tcx, ty, true, self.output);
10071008
}
10081009
}

0 commit comments

Comments
 (0)