treat host effect params as erased generics in codegen
This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`.
This commit is contained in:
parent
7e0261e7ea
commit
a0a801cd38
17 changed files with 71 additions and 41 deletions
|
@ -108,7 +108,6 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
|||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
|
||||
use rustc_middle::mir::mono::{InstantiationMode, MonoItem};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{self, Instance, TyCtxt};
|
||||
use rustc_session::config::SymbolManglingVersion;
|
||||
|
||||
|
@ -144,7 +143,7 @@ fn symbol_name_provider<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> ty
|
|||
// This closure determines the instantiating crate for instances that
|
||||
// need an instantiating-crate-suffix for their symbol name, in order
|
||||
// to differentiate between local copies.
|
||||
if is_generic(instance.args) {
|
||||
if is_generic(instance, tcx) {
|
||||
// For generics we might find re-usable upstream instances. If there
|
||||
// is one, we rely on the symbol being instantiated locally.
|
||||
instance.upstream_monomorphization(tcx).unwrap_or(LOCAL_CRATE)
|
||||
|
@ -246,7 +245,7 @@ fn compute_symbol_name<'tcx>(
|
|||
// the ID of the instantiating crate. This avoids symbol conflicts
|
||||
// in case the same instances is emitted in two crates of the same
|
||||
// project.
|
||||
let avoid_cross_crate_conflicts = is_generic(args) || is_globally_shared_function;
|
||||
let avoid_cross_crate_conflicts = is_generic(instance, tcx) || is_globally_shared_function;
|
||||
|
||||
let instantiating_crate = avoid_cross_crate_conflicts.then(compute_instantiating_crate);
|
||||
|
||||
|
@ -278,6 +277,6 @@ fn compute_symbol_name<'tcx>(
|
|||
symbol
|
||||
}
|
||||
|
||||
fn is_generic(args: GenericArgsRef<'_>) -> bool {
|
||||
args.non_erasable_generics().next().is_some()
|
||||
fn is_generic<'tcx>(instance: Instance<'tcx>, tcx: TyCtxt<'tcx>) -> bool {
|
||||
instance.args.non_erasable_generics(tcx, instance.def_id()).next().is_some()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue