Skip to content

Rollup of 9 pull requests #142615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1e10dfc
Add all rustc_std_internal_symbol to symbols.o
bjorn3 May 8, 2025
2d2d70f
Remove dependency injection for the panic runtime
bjorn3 May 8, 2025
3a7ae67
Stop handling explicit dependencies on the panic runtime
bjorn3 May 8, 2025
f8d1bfa
Avoid exporting panic_unwind as stdlib cargo feature
bjorn3 May 8, 2025
6df5456
Make comment on activate_injected_dep a doc comment
bjorn3 May 9, 2025
3cb0cba
Handle win32 separator & prefixes for cygwin paths
Berrysoft Jun 1, 2025
7cfc51b
Update books
rustbot Jun 16, 2025
8a7b50a
Fold unnecessary visit_struct_field_def in AstValidator
compiler-errors Jun 16, 2025
ad60d8e
Make sure to propagate result from visit_expr_fields
compiler-errors Jun 16, 2025
ac8b506
Fix some unused fields in AST visitor
compiler-errors Jun 16, 2025
7b29a5d
Revert overeager warning for misuse of `--print native-static-libs`
workingjubilee Jun 16, 2025
7859a37
explicitly set llvm_abiname option on existing ppc64 targets
ostylk Jun 11, 2025
9c1180b
indicate ppc64 elf abi in e_flags
ostylk Jun 11, 2025
00c1042
rustdoc: make srcIndex no longer a global variable
lolbinarycat Jun 5, 2025
fb75e09
Add a comment to `FORMAT_VERSION`.
nnethercote Jun 16, 2025
d5c6ba3
Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=wesleywiser…
workingjubilee Jun 17, 2025
7aa10ca
Rollup merge of #141864 - Berrysoft:cygwin-path, r=ChrisDenton
workingjubilee Jun 17, 2025
29b7333
Rollup merge of #142100 - lolbinarycat:rustdoc-srcIndex-138467, r=Gui…
workingjubilee Jun 17, 2025
29892b8
Rollup merge of #142585 - rustbot:docs-update, r=ehuss
workingjubilee Jun 17, 2025
ba05d71
Rollup merge of #142586 - compiler-errors:remove-visit-struct-field-d…
workingjubilee Jun 17, 2025
b421416
Rollup merge of #142587 - compiler-errors:try-visit-expr-fields, r=ji…
workingjubilee Jun 17, 2025
0063fee
Rollup merge of #142595 - workingjubilee:revert-warning-138139, r=Chr…
workingjubilee Jun 17, 2025
2294210
Rollup merge of #142598 - ostylk:fix/ppc64_llvmabi, r=nikic,workingju…
workingjubilee Jun 17, 2025
4e1718e
Rollup merge of #142601 - nnethercote:format_version-comment, r=aDotI…
workingjubilee Jun 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ macro_rules! common_visitor_and_walkers {
TyKind::BareFn(function_declaration) => {
let BareFnTy { safety, ext: _, generic_params, decl, decl_span } =
&$($mut)? **function_declaration;
visit_safety(vis, safety);
try_visit!(visit_safety(vis, safety));
try_visit!(visit_generic_params(vis, generic_params));
try_visit!(vis.visit_fn_decl(decl));
try_visit!(visit_span(vis, decl_span));
Expand Down Expand Up @@ -1235,7 +1235,7 @@ macro_rules! common_visitor_and_walkers {
bounds,
bound_generic_params,
}) => {
visit_generic_params(vis, bound_generic_params);
try_visit!(visit_generic_params(vis, bound_generic_params));
try_visit!(vis.visit_ty(bounded_ty));
walk_list!(vis, visit_param_bound, bounds, BoundKind::Bound);
}
Expand Down Expand Up @@ -1420,7 +1420,7 @@ macro_rules! common_visitor_and_walkers {
let StructExpr { qself, path, fields, rest } = &$($mut)?**se;
try_visit!(vis.visit_qself(qself));
try_visit!(vis.visit_path(path));
visit_expr_fields(vis, fields);
try_visit!(visit_expr_fields(vis, fields));
match rest {
StructRest::Base(expr) => try_visit!(vis.visit_expr(expr)),
StructRest::Rest(_span) => {}
Expand Down
20 changes: 2 additions & 18 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,6 @@ impl<'a> AstValidator<'a> {
}
}

fn visit_struct_field_def(&mut self, field: &'a FieldDef) {
if let Some(ref ident) = field.ident
&& ident.name == kw::Underscore
{
self.visit_vis(&field.vis);
self.visit_ident(ident);
self.visit_ty_common(&field.ty);
self.walk_ty(&field.ty);
walk_list!(self, visit_attribute, &field.attrs);
} else {
self.visit_field_def(field);
}
}

fn dcx(&self) -> DiagCtxtHandle<'a> {
self.sess.dcx()
}
Expand Down Expand Up @@ -1135,8 +1121,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
VariantData::Struct { fields, .. } => {
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
self.visit_generics(generics);
// Permit `Anon{Struct,Union}` as field type.
walk_list!(self, visit_struct_field_def, fields);
walk_list!(self, visit_field_def, fields);
}
_ => visit::walk_item(self, item),
},
Expand All @@ -1148,8 +1133,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
VariantData::Struct { fields, .. } => {
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
self.visit_generics(generics);
// Permit `Anon{Struct,Union}` as field type.
walk_list!(self, visit_struct_field_def, fields);
walk_list!(self, visit_field_def, fields);
}
_ => visit::walk_item(self, item),
}
Expand Down
19 changes: 0 additions & 19 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,6 @@ pub fn ensure_removed(dcx: DiagCtxtHandle<'_>, path: &Path) {
}
}

fn check_link_info_print_request(sess: &Session, crate_types: &[CrateType]) {
let print_native_static_libs =
sess.opts.prints.iter().any(|p| p.kind == PrintKind::NativeStaticLibs);
let has_staticlib = crate_types.iter().any(|ct| *ct == CrateType::Staticlib);
if print_native_static_libs {
if !has_staticlib {
sess.dcx()
.warn(format!("cannot output linkage information without staticlib crate-type"));
sess.dcx()
.note(format!("consider `--crate-type staticlib` to print linkage information"));
} else if !sess.opts.output_types.should_link() {
sess.dcx()
.warn(format!("cannot output linkage information when --emit link is not passed"));
}
}
}

/// Performs the linkage portion of the compilation phase. This will generate all
/// of the requested outputs for this compilation session.
pub fn link_binary(
Expand Down Expand Up @@ -208,8 +191,6 @@ pub fn link_binary(
}
}

check_link_info_print_request(sess, &codegen_results.crate_info.crate_types);

// Remove the temporary object file and metadata if we aren't saving temps.
sess.time("link_binary_remove_temps", || {
// If the user requests that temporaries are saved, don't delete any.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,7 @@ pub(crate) fn linked_symbols(
for_each_exported_symbols_include_dep(tcx, crate_type, |symbol, info, cnum| {
if info.level.is_below_threshold(export_threshold) && !tcx.is_compiler_builtins(cnum)
|| info.used
|| info.rustc_std_internal_symbol
{
symbols.push((
symbol_export::linking_symbol_name_for_instance_in_crate(tcx, symbol, cnum),
Expand Down
18 changes: 18 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,24 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
};
e_flags
}
Architecture::PowerPc64 => {
const EF_PPC64_ABI_UNKNOWN: u32 = 0;
const EF_PPC64_ABI_ELF_V1: u32 = 1;
const EF_PPC64_ABI_ELF_V2: u32 = 2;

match sess.target.options.llvm_abiname.as_ref() {
// If the flags do not correctly indicate the ABI,
// linkers such as ld.lld assume that the ppc64 object files are always ELFv2
// which leads to broken binaries if ELFv1 is used for the object files.
"elfv1" => EF_PPC64_ABI_ELF_V1,
"elfv2" => EF_PPC64_ABI_ELF_V2,
"" if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
bug!("No ABI specified for this PPC64 ELF target");
}
// Fall back
_ => EF_PPC64_ABI_UNKNOWN,
}
}
_ => 0,
}
}
Expand Down
17 changes: 17 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
used: codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_COMPILER)
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER)
|| used,
rustc_std_internal_symbol: codegen_attrs
.flags
.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL),
};
(def_id.to_def_id(), info)
})
Expand All @@ -143,6 +146,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
level: SymbolExportLevel::C,
kind: SymbolExportKind::Data,
used: false,
rustc_std_internal_symbol: false,
},
);
}
Expand Down Expand Up @@ -191,6 +195,7 @@ fn exported_symbols_provider_local<'tcx>(
level: info.level,
kind: SymbolExportKind::Text,
used: info.used,
rustc_std_internal_symbol: info.rustc_std_internal_symbol,
},
)
})
Expand All @@ -207,6 +212,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::C,
kind: SymbolExportKind::Text,
used: false,
rustc_std_internal_symbol: false,
},
));
}
Expand All @@ -229,6 +235,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::Rust,
kind: SymbolExportKind::Text,
used: false,
rustc_std_internal_symbol: true,
},
));
}
Expand All @@ -243,6 +250,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::Rust,
kind: SymbolExportKind::Data,
used: false,
rustc_std_internal_symbol: true,
},
))
}
Expand All @@ -262,6 +270,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::C,
kind: SymbolExportKind::Data,
used: false,
rustc_std_internal_symbol: false,
},
)
}));
Expand All @@ -287,6 +296,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::C,
kind: SymbolExportKind::Data,
used: false,
rustc_std_internal_symbol: false,
},
)
}));
Expand All @@ -304,6 +314,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::C,
kind: SymbolExportKind::Data,
used: true,
rustc_std_internal_symbol: false,
},
));
}
Expand Down Expand Up @@ -379,6 +390,8 @@ fn exported_symbols_provider_local<'tcx>(
}
}

// Note: These all set rustc_std_internal_symbol to false as generic functions must not
// be marked with this attribute and we are only handling generic functions here.
match *mono_item {
MonoItem::Fn(Instance { def: InstanceKind::Item(def), args }) => {
let has_generics = args.non_erasable_generics().next().is_some();
Expand All @@ -394,6 +407,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::Rust,
kind: SymbolExportKind::Text,
used: false,
rustc_std_internal_symbol: false,
},
));
}
Expand All @@ -416,6 +430,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::Rust,
kind: SymbolExportKind::Text,
used: false,
rustc_std_internal_symbol: false,
},
));
}
Expand All @@ -432,6 +447,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::Rust,
kind: SymbolExportKind::Text,
used: false,
rustc_std_internal_symbol: false,
},
));
}
Expand All @@ -442,6 +458,7 @@ fn exported_symbols_provider_local<'tcx>(
level: SymbolExportLevel::Rust,
kind: SymbolExportKind::Text,
used: false,
rustc_std_internal_symbol: false,
},
));
}
Expand Down
22 changes: 1 addition & 21 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::{Duration, Instant};
use itertools::Itertools;
use rustc_abi::FIRST_VARIANT;
use rustc_ast as ast;
use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, AllocatorKind, global_fn_name};
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_attr_data_structures::OptimizeAttr;
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
Expand Down Expand Up @@ -1039,26 +1039,6 @@ impl CrateInfo {
.collect::<Vec<_>>();
symbols.sort_unstable_by(|a, b| a.0.cmp(&b.0));
linked_symbols.extend(symbols);
if tcx.allocator_kind(()).is_some() {
// At least one crate needs a global allocator. This crate may be placed
// after the crate that defines it in the linker order, in which case some
// linkers return an error. By adding the global allocator shim methods to
// the linked_symbols list, linking the generated symbols.o will ensure that
// circular dependencies involving the global allocator don't lead to linker
// errors.
linked_symbols.extend(ALLOCATOR_METHODS.iter().map(|method| {
(
format!(
"{prefix}{}",
mangle_internal_symbol(
tcx,
global_fn_name(method.name).as_str()
)
),
SymbolExportKind::Text,
)
}));
}
});
}

Expand Down
Loading
Loading