Skip to content

Commit d30ad80

Browse files
Rename Instance::new to Instance::new_raw and add a note that it is raw
1 parent 4fb648a commit d30ad80

File tree

18 files changed

+41
-33
lines changed

18 files changed

+41
-33
lines changed

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
12821282
intrinsic.name,
12831283
);
12841284
}
1285-
return Err(Instance::new(instance.def_id(), instance.args));
1285+
return Err(Instance::new_raw(instance.def_id(), instance.args));
12861286
}
12871287
}
12881288

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
399399
}
400400

401401
// Fall back to default body
402-
_ => return Err(Instance::new(instance.def_id(), instance.args)),
402+
_ => return Err(Instance::new_raw(instance.def_id(), instance.args)),
403403
};
404404

405405
if !fn_abi.ret.is_ignore() {

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn make_dummy_instance<'tcx>(tcx: TyCtxt<'tcx>, local_def_id: LocalDefId) -> ty:
157157
let def_id = local_def_id.to_def_id();
158158

159159
// Make a dummy instance that fills in all generics with placeholders.
160-
ty::Instance::new(
160+
ty::Instance::new_raw(
161161
def_id,
162162
ty::GenericArgs::for_item(tcx, def_id, |param, _| {
163163
if let ty::GenericParamDefKind::Lifetime = param.kind {

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
613613
_ => {
614614
debug!("unknown intrinsic '{}' -- falling back to default body", name);
615615
// Call the fallback body instead of generating the intrinsic code
616-
return Err(ty::Instance::new(instance.def_id(), instance.args));
616+
return Err(ty::Instance::new_raw(instance.def_id(), instance.args));
617617
}
618618
};
619619

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>(
556556
ExportedSymbol::Generic(def_id, args) => {
557557
rustc_symbol_mangling::symbol_name_for_instance_in_crate(
558558
tcx,
559-
Instance::new(def_id, args),
559+
Instance::new_raw(def_id, args),
560560
instantiating_crate,
561561
)
562562
}
@@ -597,7 +597,7 @@ fn calling_convention_for_symbol<'tcx>(
597597
None
598598
}
599599
ExportedSymbol::NonGeneric(def_id) => Some(Instance::mono(tcx, def_id)),
600-
ExportedSymbol::Generic(def_id, args) => Some(Instance::new(def_id, args)),
600+
ExportedSymbol::Generic(def_id, args) => Some(Instance::new_raw(def_id, args)),
601601
// DropGlue always use the Rust calling convention and thus follow the target's default
602602
// symbol decoration scheme.
603603
ExportedSymbol::DropGlue(..) => None,

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
216216
check::maybe_check_static_with_link_section(tcx, item_def_id);
217217
}
218218
DefKind::Const if tcx.generics_of(item_def_id).is_empty() => {
219-
let instance = ty::Instance::new(item_def_id.into(), ty::GenericArgs::empty());
219+
let instance = ty::Instance::new_raw(item_def_id.into(), ty::GenericArgs::empty());
220220
let cid = GlobalId { instance, promoted: None };
221221
let typing_env = ty::TypingEnv::fully_monomorphized();
222222
tcx.ensure_ok().eval_to_const_value_raw(typing_env.as_query_input(cid));

compiler/rustc_lint/src/foreign_modules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl ClashingExternDeclarations {
104104
/// for the item, return its HirId without updating the set.
105105
fn insert(&mut self, tcx: TyCtxt<'_>, fi: hir::ForeignItemId) -> Option<hir::OwnerId> {
106106
let did = fi.owner_id.to_def_id();
107-
let instance = Instance::new(did, ty::List::identity_for_item(tcx, did));
107+
let instance = Instance::new_raw(did, ty::List::identity_for_item(tcx, did));
108108
let name = Symbol::intern(tcx.symbol_name(instance).name);
109109
if let Some(&existing_id) = self.seen_decls.get(&name) {
110110
// Avoid updating the map with the new entry when we do find a collision. We want to

compiler/rustc_middle/src/middle/exported_symbols.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'tcx> ExportedSymbol<'tcx> {
5555
match *self {
5656
ExportedSymbol::NonGeneric(def_id) => tcx.symbol_name(ty::Instance::mono(tcx, def_id)),
5757
ExportedSymbol::Generic(def_id, args) => {
58-
tcx.symbol_name(ty::Instance::new(def_id, args))
58+
tcx.symbol_name(ty::Instance::new_raw(def_id, args))
5959
}
6060
ExportedSymbol::DropGlue(ty) => {
6161
tcx.symbol_name(ty::Instance::resolve_drop_in_place(tcx, ty))

compiler/rustc_middle/src/mir/interpret/queries.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'tcx> TyCtxt<'tcx> {
2323
// into `const_eval` which will return `ErrorHandled::TooGeneric` if any of them are
2424
// encountered.
2525
let args = GenericArgs::identity_for_item(self, def_id);
26-
let instance = ty::Instance::new(def_id, args);
26+
let instance = ty::Instance::new_raw(def_id, args);
2727
let cid = GlobalId { instance, promoted: None };
2828
let typing_env = ty::TypingEnv::post_analysis(self, def_id);
2929
self.const_eval_global_id(typing_env, cid, DUMMY_SP)
@@ -39,7 +39,7 @@ impl<'tcx> TyCtxt<'tcx> {
3939
// into `const_eval` which will return `ErrorHandled::TooGeneric` if any of them are
4040
// encountered.
4141
let args = GenericArgs::identity_for_item(self, def_id);
42-
let instance = ty::Instance::new(def_id, args);
42+
let instance = ty::Instance::new_raw(def_id, args);
4343
let cid = GlobalId { instance, promoted: None };
4444
let typing_env = ty::TypingEnv::post_analysis(self, def_id);
4545
let inputs = self.erase_regions(typing_env.as_query_input(cid));
@@ -208,7 +208,7 @@ impl<'tcx> TyCtxtEnsureOk<'tcx> {
208208
// into `const_eval` which will return `ErrorHandled::TooGeneric` if any of them are
209209
// encountered.
210210
let args = GenericArgs::identity_for_item(self.tcx, def_id);
211-
let instance = ty::Instance::new(def_id, self.tcx.erase_regions(args));
211+
let instance = ty::Instance::new_raw(def_id, self.tcx.erase_regions(args));
212212
let cid = GlobalId { instance, promoted: None };
213213
let typing_env = ty::TypingEnv::post_analysis(self.tcx, def_id);
214214
// Const-eval shouldn't depend on lifetimes at all, so we can erase them, which should

compiler/rustc_middle/src/mir/mono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl<'tcx> fmt::Display for MonoItem<'tcx> {
318318
match *self {
319319
MonoItem::Fn(instance) => write!(f, "fn {instance}"),
320320
MonoItem::Static(def_id) => {
321-
write!(f, "static {}", Instance::new(def_id, GenericArgs::empty()))
321+
write!(f, "static {}", Instance::new_raw(def_id, GenericArgs::empty()))
322322
}
323323
MonoItem::GlobalAsm(..) => write!(f, "global_asm"),
324324
}

0 commit comments

Comments
 (0)