mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
Use non_erasable_generics for codegen
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
parent
386e9fbda2
commit
2ce19ae3d1
@ -113,7 +113,7 @@ pub fn get_fn(
|
|||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::ExternalLinkage);
|
llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::ExternalLinkage);
|
||||||
|
|
||||||
let is_generic = instance.substs.types().next().is_some();
|
let is_generic = instance.substs.non_erasable_generics().next().is_some();
|
||||||
|
|
||||||
if is_generic {
|
if is_generic {
|
||||||
// This is a monomorphization. Its expected visibility depends
|
// This is a monomorphization. Its expected visibility depends
|
||||||
|
@ -263,7 +263,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||||||
def: InstanceDef::Item(def_id),
|
def: InstanceDef::Item(def_id),
|
||||||
substs,
|
substs,
|
||||||
}) = mono_item {
|
}) = mono_item {
|
||||||
if substs.types().next().is_some() {
|
if substs.non_erasable_generics().next().is_some() {
|
||||||
symbols.push((ExportedSymbol::Generic(def_id, substs),
|
symbols.push((ExportedSymbol::Generic(def_id, substs),
|
||||||
SymbolExportLevel::Rust));
|
SymbolExportLevel::Rust));
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,8 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let val = match val.val {
|
let val = match val.val {
|
||||||
|
ConstValue::Param(_) => bug!("encountered a ConstValue::Param in codegen"),
|
||||||
|
ConstValue::Infer(_) => bug!("encountered a ConstValue::Infer in codegen"),
|
||||||
ConstValue::Scalar(x) => {
|
ConstValue::Scalar(x) => {
|
||||||
let scalar = match layout.abi {
|
let scalar = match layout.abi {
|
||||||
layout::Abi::Scalar(ref x) => x,
|
layout::Abi::Scalar(ref x) => x,
|
||||||
|
@ -172,7 +172,7 @@ fn get_symbol_hash<'a, 'tcx>(
|
|||||||
assert!(!substs.needs_subst());
|
assert!(!substs.needs_subst());
|
||||||
substs.hash_stable(&mut hcx, &mut hasher);
|
substs.hash_stable(&mut hcx, &mut hasher);
|
||||||
|
|
||||||
let is_generic = substs.types().next().is_some();
|
let is_generic = substs.non_erasable_generics().next().is_some();
|
||||||
let avoid_cross_crate_conflicts =
|
let avoid_cross_crate_conflicts =
|
||||||
// If this is an instance of a generic function, we also hash in
|
// If this is an instance of a generic function, we also hash in
|
||||||
// the ID of the instantiating crate. This avoids symbol conflicts
|
// the ID of the instantiating crate. This avoids symbol conflicts
|
||||||
|
Loading…
Reference in New Issue
Block a user