Skip to content

Commit 2ce19ae

Browse files
varkoryodaldevoid
andcommitted
Use non_erasable_generics for codegen
Co-Authored-By: Gabriel Smith <[email protected]>
1 parent 386e9fb commit 2ce19ae

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

src/librustc_codegen_llvm/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn get_fn(
113113
unsafe {
114114
llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::ExternalLinkage);
115115

116-
let is_generic = instance.substs.types().next().is_some();
116+
let is_generic = instance.substs.non_erasable_generics().next().is_some();
117117

118118
if is_generic {
119119
// This is a monomorphization. Its expected visibility depends

src/librustc_codegen_ssa/back/symbol_export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
263263
def: InstanceDef::Item(def_id),
264264
substs,
265265
}) = mono_item {
266-
if substs.types().next().is_some() {
266+
if substs.non_erasable_generics().next().is_some() {
267267
symbols.push((ExportedSymbol::Generic(def_id, substs),
268268
SymbolExportLevel::Rust));
269269
}

src/librustc_codegen_ssa/mir/operand.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> {
7676
}
7777

7878
let val = match val.val {
79+
ConstValue::Param(_) => bug!("encountered a ConstValue::Param in codegen"),
80+
ConstValue::Infer(_) => bug!("encountered a ConstValue::Infer in codegen"),
7981
ConstValue::Scalar(x) => {
8082
let scalar = match layout.abi {
8183
layout::Abi::Scalar(ref x) => x,

src/librustc_codegen_utils/symbol_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ fn get_symbol_hash<'a, 'tcx>(
172172
assert!(!substs.needs_subst());
173173
substs.hash_stable(&mut hcx, &mut hasher);
174174

175-
let is_generic = substs.types().next().is_some();
175+
let is_generic = substs.non_erasable_generics().next().is_some();
176176
let avoid_cross_crate_conflicts =
177177
// If this is an instance of a generic function, we also hash in
178178
// the ID of the instantiating crate. This avoids symbol conflicts

0 commit comments

Comments
 (0)