Rollup merge of #114622 - petrochenkov:noplugin, r=oli-obk
rustc: Move `crate_types` and `stable_crate_id` from `Session` to `GlobalCtxt` Removes two pieces of mutable state. Follow up to https://github.com/rust-lang/rust/pull/114578.
This commit is contained in:
commit
94533d924e
32 changed files with 133 additions and 135 deletions
|
@ -209,7 +209,7 @@ pub unsafe fn create_module<'ll>(
|
|||
// PIE is potentially more effective than PIC, but can only be used in executables.
|
||||
// If all our outputs are executables, then we can relax PIC to PIE.
|
||||
if reloc_model == RelocModel::Pie
|
||||
|| sess.crate_types().iter().all(|ty| *ty == CrateType::Executable)
|
||||
|| tcx.crate_types().iter().all(|ty| *ty == CrateType::Executable)
|
||||
{
|
||||
llvm::LLVMRustSetModulePIELevel(llmod);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ pub fn needs_gdb_debug_scripts_section(cx: &CodegenCx<'_, '_>) -> bool {
|
|||
// each rlib could produce a different set of visualizers that would be embedded
|
||||
// in the `.debug_gdb_scripts` section. For that reason, we make sure that the
|
||||
// section is only emitted for leaf crates.
|
||||
let embed_visualizers = cx.sess().crate_types().iter().any(|&crate_type| match crate_type {
|
||||
let embed_visualizers = cx.tcx.crate_types().iter().any(|&crate_type| match crate_type {
|
||||
CrateType::Executable | CrateType::Dylib | CrateType::Cdylib | CrateType::Staticlib => {
|
||||
// These are crate types for which we will embed pretty printers since they
|
||||
// are treated as leaf crates.
|
||||
|
|
|
@ -111,7 +111,7 @@ impl CodegenCx<'_, '_> {
|
|||
}
|
||||
|
||||
// Symbols from executables can't really be imported any further.
|
||||
let all_exe = self.tcx.sess.crate_types().iter().all(|ty| *ty == CrateType::Executable);
|
||||
let all_exe = self.tcx.crate_types().iter().all(|ty| *ty == CrateType::Executable);
|
||||
let is_declaration_for_linker =
|
||||
is_declaration || linkage == llvm::Linkage::AvailableExternallyLinkage;
|
||||
if all_exe && !is_declaration_for_linker {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue