Use local key in providers
This commit is contained in:
parent
a01b4cc9f3
commit
2eb1c08e43
65 changed files with 458 additions and 395 deletions
|
@ -41,9 +41,7 @@ pub fn crates_export_threshold(crate_types: &[CrateType]) -> SymbolExportLevel {
|
|||
}
|
||||
}
|
||||
|
||||
fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<SymbolExportInfo> {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
fn reachable_non_generics_provider(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<SymbolExportInfo> {
|
||||
if !tcx.sess.opts.output_types.should_codegen() {
|
||||
return Default::default();
|
||||
}
|
||||
|
@ -154,10 +152,10 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
|
|||
reachable_non_generics
|
||||
}
|
||||
|
||||
fn is_reachable_non_generic_provider_local(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
fn is_reachable_non_generic_provider_local(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
||||
let export_threshold = threshold(tcx);
|
||||
|
||||
if let Some(&info) = tcx.reachable_non_generics(def_id.krate).get(&def_id) {
|
||||
if let Some(&info) = tcx.reachable_non_generics(LOCAL_CRATE).get(&def_id.to_def_id()) {
|
||||
info.level.is_below_threshold(export_threshold)
|
||||
} else {
|
||||
false
|
||||
|
@ -170,10 +168,8 @@ fn is_reachable_non_generic_provider_extern(tcx: TyCtxt<'_>, def_id: DefId) -> b
|
|||
|
||||
fn exported_symbols_provider_local(
|
||||
tcx: TyCtxt<'_>,
|
||||
cnum: CrateNum,
|
||||
(): (),
|
||||
) -> &[(ExportedSymbol<'_>, SymbolExportInfo)] {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
if !tcx.sess.opts.output_types.should_codegen() {
|
||||
return &[];
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: LocalDefId, name: &str) -> Linkage {
|
|||
}
|
||||
}
|
||||
|
||||
fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
|
||||
fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
||||
if cfg!(debug_assertions) {
|
||||
let def_kind = tcx.def_kind(did);
|
||||
assert!(
|
||||
|
@ -52,7 +52,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
|
|||
);
|
||||
}
|
||||
|
||||
let did = did.expect_local();
|
||||
let attrs = tcx.hir().attrs(tcx.hir().local_def_id_to_hir_id(did));
|
||||
let mut codegen_fn_attrs = CodegenFnAttrs::new();
|
||||
if tcx.should_inherit_track_caller(did) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue