diff options
| author | bors <bors@rust-lang.org> | 2024-03-12 10:29:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-12 10:29:15 +0000 |
| commit | 3b85d2c7fc6d1698e68b94f7bc1a5c9633f2554d (patch) | |
| tree | b76611e92ca15c4b889185b1de1f92120017c64e /compiler/rustc_codegen_ssa/src/back | |
| parent | 5b7343b96681c93f6fe752b46d9427f9dee8f94b (diff) | |
| parent | e2773733f35f71dba92588d6b29e43d2cc035a34 (diff) | |
| download | rust-3b85d2c7fc6d1698e68b94f7bc1a5c9633f2554d.tar.gz rust-3b85d2c7fc6d1698e68b94f7bc1a5c9633f2554d.zip | |
Auto merge of #121644 - oli-obk:unique_static_innards2, r=RalfJung,nnethercote
Ensure nested allocations in statics neither get deduplicated nor duplicated This PR generates new `DefId`s for nested allocations in static items and feeds all the right queries to make the compiler believe these are regular `static` items. I chose this design, because all other designs are fragile and make the compiler horribly complex for such a niche use case. At present this wrecks incremental compilation performance *in case nested allocations exist* (because any query creating a `DefId` will be recomputed and never loaded from the cache). This will be resolved later in https://github.com/rust-lang/rust/pull/115613 . All other statics are unaffected by this change and will not have performance regressions (heh, famous last words) This PR contains various smaller refactorings that can be pulled out into separate PRs. It is best reviewed commit-by-commit. The last commit is where the actual magic happens. r? `@RalfJung` on the const interner and engine changes fixes https://github.com/rust-lang/rust/issues/79738
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/symbol_export.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 72648e5ade4..87b6f0e914c 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -87,7 +87,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S // Only consider nodes that actually have exported symbols. match tcx.def_kind(def_id) { - DefKind::Fn | DefKind::Static(_) => {} + DefKind::Fn | DefKind::Static { .. } => {} DefKind::AssocFn if tcx.impl_of_method(def_id.to_def_id()).is_some() => {} _ => return None, }; @@ -483,7 +483,7 @@ fn symbol_export_level(tcx: TyCtxt<'_>, sym_def_id: DefId) -> SymbolExportLevel let target = &tcx.sess.target.llvm_target; // WebAssembly cannot export data symbols, so reduce their export level if target.contains("emscripten") { - if let DefKind::Static(_) = tcx.def_kind(sym_def_id) { + if let DefKind::Static { .. } = tcx.def_kind(sym_def_id) { return SymbolExportLevel::Rust; } } |
