Skip to content

Rollup of 12 pull requests #140690

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 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5f14568
std: get rid of `sys_common::process`
joboet Mar 27, 2025
0f81fca
Change rustc_driver dependency on stable_mir crate
celinval Apr 30, 2025
415a73e
docs: alias `limit` to `Iterator::take`, cite `[u8]::utf8_chunks` in …
ShE3py May 2, 2025
cbdd713
Implement Iterator::last for vec::IntoIter
thaliaarchi Apr 13, 2025
6621826
Implement RFC 3503: frontmatters
fee1-dead Apr 12, 2025
b796179
Created `tests/rustdoc/reexports` subfolder to limit number of files …
GuillaumeGomez May 5, 2025
099f730
Created `tests/rustdoc/source-code-pages` subfolder to limit number o…
GuillaumeGomez May 5, 2025
b374996
Created `tests/rustdoc/anchors` subfolder to limit number of files at…
GuillaumeGomez May 5, 2025
ff971d0
Created `tests/rustdoc/auto` subfolder to limit number of files at th…
GuillaumeGomez May 5, 2025
9db7de5
Created `tests/rustdoc/jump-to-def` subfolder to limit number of file…
GuillaumeGomez May 5, 2025
a00b399
Move intra-doc tests into the expected subfolder
GuillaumeGomez May 5, 2025
eee6c97
Created `tests/rustdoc/private` subfolder to limit number of files at…
GuillaumeGomez May 5, 2025
d1f4a0b
Created `tests/rustdoc/macro` subfolder to limit number of files at t…
GuillaumeGomez May 5, 2025
be71d8b
Created `tests/rustdoc/doc-cfg` subfolder to limit number of files at…
GuillaumeGomez May 5, 2025
b84f4cc
Created `tests/rustdoc/impl` subfolder to limit number of files at th…
GuillaumeGomez May 5, 2025
fa2b922
Created `tests/rustdoc/assoc` subfolder to limit number of files at t…
GuillaumeGomez May 5, 2025
4b6bc73
Created `tests/rustdoc/enum` subfolder to limit number of files at th…
GuillaumeGomez May 5, 2025
e245c3b
Move primitive rustdoc tests into the `primitive` sub folder
GuillaumeGomez May 5, 2025
e14e19a
Created `tests/rustdoc/extern` subfolder to limit number of files at …
GuillaumeGomez May 5, 2025
27e39c3
Created `tests/rustdoc/async` subfolder to limit number of files at t…
GuillaumeGomez May 5, 2025
fa6d0d1
Use more accurate ELF flags on MIPS
smrobtzz May 4, 2025
57941af
Apply suggestions from code review
smrobtzz May 5, 2025
6a7996e
Take into-account `-Zremap-path-scope` when embedding filenames
Urgau Apr 19, 2025
c0dfa44
Be a bit more relaxed about not yet constrained infer vars in closure…
compiler-errors May 5, 2025
9c11c02
[Arm64EC] Only decorate functions with `#`
dpaoliello Apr 25, 2025
292aea5
Update mdbook to 0.4.49
ehuss May 5, 2025
a3d5562
bootstrap: Add check/test/run steps for src/tools/coverage-dump
Zalathar Apr 22, 2025
89319f2
coverage-dump: Extract some common code to an `llvm_utils` submodule
Zalathar Apr 23, 2025
bc3f0e3
coverage-dump: Extract a common parser method for maybe-compressed bytes
Zalathar Apr 23, 2025
f1b8cd4
coverage-dump: Include filenames hash in covfun line data
Zalathar Apr 22, 2025
041b2b2
coverage-dump: Make filenames available to covfun record dumping
Zalathar Apr 24, 2025
c53a767
coverage-dump: Dump filenames instead of global file IDs (and bless)
Zalathar Apr 24, 2025
51b74c9
Rollup merge of #139550 - Urgau:rmeta-remap-path-scope, r=nnethercote
Zalathar May 6, 2025
608e98a
Rollup merge of #139773 - thaliaarchi:vec-into-iter-last, r=workingju…
Zalathar May 6, 2025
b90beb5
Rollup merge of #140035 - fee1-dead-contrib:push-oszwkkvmpkks, r=jiey…
Zalathar May 6, 2025
24262b7
Rollup merge of #140176 - dpaoliello:arm64ecdec, r=wesleywiser
Zalathar May 6, 2025
c667fd9
Rollup merge of #140251 - Zalathar:coverage-dump-path, r=clubby789
Zalathar May 6, 2025
fa02cb0
Rollup merge of #140393 - joboet:sys_common_process, r=thomcc
Zalathar May 6, 2025
e650155
Rollup merge of #140532 - celinval:chores-smir-ra, r=oli-obk
Zalathar May 6, 2025
7300b97
Rollup merge of #140598 - ShE3py:iter-misc-docs, r=workingjubilee
Zalathar May 6, 2025
a7c6b50
Rollup merge of #140634 - smrobtzz:mips-elf-fixes, r=workingjubilee
Zalathar May 6, 2025
c1272ba
Rollup merge of #140673 - GuillaumeGomez:clean-rustdoc-tests, r=notri…
Zalathar May 6, 2025
8eec52e
Rollup merge of #140678 - compiler-errors:dont-ice-on-infer-in-upvar,…
Zalathar May 6, 2025
1e27a12
Rollup merge of #140687 - ehuss:update-mdbook, r=jieyouxu
Zalathar May 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ name = "coverage-dump"
version = "0.1.0"
dependencies = [
"anyhow",
"itertools",
"leb128",
"md-5",
"miniz_oxide 0.7.4",
Expand Down Expand Up @@ -3604,13 +3605,13 @@ dependencies = [
"rustc_query_system",
"rustc_resolve",
"rustc_session",
"rustc_smir",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"rustc_ty_utils",
"serde_json",
"shlex",
"stable_mir",
"tracing",
"windows 0.59.0",
]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
gate_all!(contracts_internals, "contract internal machinery is for internal use only");
gate_all!(where_clause_attrs, "attributes in `where` clause are unstable");
gate_all!(super_let, "`super let` is experimental");
gate_all!(frontmatter, "frontmatters are experimental");

if !visitor.features.never_patterns() {
if let Some(spans) = spans.get(&sym::never_patterns) {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ impl<'ll> CodegenCx<'ll, '_> {

if !def_id.is_local() {
let needs_dll_storage_attr = self.use_dll_storage_attrs
&& !self.tcx.is_foreign_item(def_id)
&& (!self.tcx.is_foreign_item(def_id)
|| fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL))
// Local definitions can never be imported, so we must not apply
// the DLLImport annotation.
&& !dso_local
Expand Down
120 changes: 90 additions & 30 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,12 @@ pub(crate) trait Linker {
fn debuginfo(&mut self, strip: Strip, natvis_debugger_visualizers: &[PathBuf]);
fn no_crt_objects(&mut self);
fn no_default_libraries(&mut self);
fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[String]);
fn export_symbols(
&mut self,
tmpdir: &Path,
crate_type: CrateType,
symbols: &[(String, SymbolExportKind)],
);
fn subsystem(&mut self, subsystem: &str);
fn linker_plugin_lto(&mut self);
fn add_eh_frame_header(&mut self) {}
Expand Down Expand Up @@ -770,7 +775,12 @@ impl<'a> Linker for GccLinker<'a> {
}
}

fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[String]) {
fn export_symbols(
&mut self,
tmpdir: &Path,
crate_type: CrateType,
symbols: &[(String, SymbolExportKind)],
) {
// Symbol visibility in object files typically takes care of this.
if crate_type == CrateType::Executable {
let should_export_executable_symbols =
Expand Down Expand Up @@ -799,7 +809,7 @@ impl<'a> Linker for GccLinker<'a> {
// Write a plain, newline-separated list of symbols
let res: io::Result<()> = try {
let mut f = File::create_buffered(&path)?;
for sym in symbols {
for (sym, _) in symbols {
debug!(" _{sym}");
writeln!(f, "_{sym}")?;
}
Expand All @@ -814,11 +824,12 @@ impl<'a> Linker for GccLinker<'a> {
// .def file similar to MSVC one but without LIBRARY section
// because LD doesn't like when it's empty
writeln!(f, "EXPORTS")?;
for symbol in symbols {
for (symbol, kind) in symbols {
let kind_marker = if *kind == SymbolExportKind::Data { " DATA" } else { "" };
debug!(" _{symbol}");
// Quote the name in case it's reserved by linker in some way
// (this accounts for names with dots in particular).
writeln!(f, " \"{symbol}\"")?;
writeln!(f, " \"{symbol}\"{kind_marker}")?;
}
};
if let Err(error) = res {
Expand All @@ -831,7 +842,7 @@ impl<'a> Linker for GccLinker<'a> {
writeln!(f, "{{")?;
if !symbols.is_empty() {
writeln!(f, " global:")?;
for sym in symbols {
for (sym, _) in symbols {
debug!(" {sym};");
writeln!(f, " {sym};")?;
}
Expand Down Expand Up @@ -1098,7 +1109,12 @@ impl<'a> Linker for MsvcLinker<'a> {
// crates. Upstream rlibs may be linked statically to this dynamic library,
// in which case they may continue to transitively be used and hence need
// their symbols exported.
fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[String]) {
fn export_symbols(
&mut self,
tmpdir: &Path,
crate_type: CrateType,
symbols: &[(String, SymbolExportKind)],
) {
// Symbol visibility takes care of this typically
if crate_type == CrateType::Executable {
let should_export_executable_symbols =
Expand All @@ -1116,9 +1132,10 @@ impl<'a> Linker for MsvcLinker<'a> {
// straight to exports.
writeln!(f, "LIBRARY")?;
writeln!(f, "EXPORTS")?;
for symbol in symbols {
for (symbol, kind) in symbols {
let kind_marker = if *kind == SymbolExportKind::Data { " DATA" } else { "" };
debug!(" _{symbol}");
writeln!(f, " {symbol}")?;
writeln!(f, " {symbol}{kind_marker}")?;
}
};
if let Err(error) = res {
Expand Down Expand Up @@ -1259,14 +1276,19 @@ impl<'a> Linker for EmLinker<'a> {
self.cc_arg("-nodefaultlibs");
}

fn export_symbols(&mut self, _tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
fn export_symbols(
&mut self,
_tmpdir: &Path,
_crate_type: CrateType,
symbols: &[(String, SymbolExportKind)],
) {
debug!("EXPORTED SYMBOLS:");

self.cc_arg("-s");

let mut arg = OsString::from("EXPORTED_FUNCTIONS=");
let encoded = serde_json::to_string(
&symbols.iter().map(|sym| "_".to_owned() + sym).collect::<Vec<_>>(),
&symbols.iter().map(|(sym, _)| "_".to_owned() + sym).collect::<Vec<_>>(),
)
.unwrap();
debug!("{encoded}");
Expand Down Expand Up @@ -1428,8 +1450,13 @@ impl<'a> Linker for WasmLd<'a> {

fn no_default_libraries(&mut self) {}

fn export_symbols(&mut self, _tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
for sym in symbols {
fn export_symbols(
&mut self,
_tmpdir: &Path,
_crate_type: CrateType,
symbols: &[(String, SymbolExportKind)],
) {
for (sym, _) in symbols {
self.link_args(&["--export", sym]);
}

Expand Down Expand Up @@ -1563,7 +1590,7 @@ impl<'a> Linker for L4Bender<'a> {
self.cc_arg("-nostdlib");
}

fn export_symbols(&mut self, _: &Path, _: CrateType, _: &[String]) {
fn export_symbols(&mut self, _: &Path, _: CrateType, _: &[(String, SymbolExportKind)]) {
// ToDo, not implemented, copy from GCC
self.sess.dcx().emit_warn(errors::L4BenderExportingSymbolsUnimplemented);
}
Expand Down Expand Up @@ -1720,12 +1747,17 @@ impl<'a> Linker for AixLinker<'a> {

fn no_default_libraries(&mut self) {}

fn export_symbols(&mut self, tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
fn export_symbols(
&mut self,
tmpdir: &Path,
_crate_type: CrateType,
symbols: &[(String, SymbolExportKind)],
) {
let path = tmpdir.join("list.exp");
let res: io::Result<()> = try {
let mut f = File::create_buffered(&path)?;
// FIXME: use llvm-nm to generate export list.
for symbol in symbols {
for (symbol, _) in symbols {
debug!(" _{symbol}");
writeln!(f, " {symbol}")?;
}
Expand Down Expand Up @@ -1769,9 +1801,12 @@ fn for_each_exported_symbols_include_dep<'tcx>(
}
}

pub(crate) fn exported_symbols(tcx: TyCtxt<'_>, crate_type: CrateType) -> Vec<String> {
pub(crate) fn exported_symbols(
tcx: TyCtxt<'_>,
crate_type: CrateType,
) -> Vec<(String, SymbolExportKind)> {
if let Some(ref exports) = tcx.sess.target.override_export_symbols {
return exports.iter().map(ToString::to_string).collect();
return exports.iter().map(|name| (name.to_string(), SymbolExportKind::Text)).collect();
}

if let CrateType::ProcMacro = crate_type {
Expand All @@ -1781,25 +1816,29 @@ pub(crate) fn exported_symbols(tcx: TyCtxt<'_>, crate_type: CrateType) -> Vec<St
}
}

fn exported_symbols_for_non_proc_macro(tcx: TyCtxt<'_>, crate_type: CrateType) -> Vec<String> {
fn exported_symbols_for_non_proc_macro(
tcx: TyCtxt<'_>,
crate_type: CrateType,
) -> Vec<(String, SymbolExportKind)> {
let mut symbols = Vec::new();
let export_threshold = symbol_export::crates_export_threshold(&[crate_type]);
for_each_exported_symbols_include_dep(tcx, crate_type, |symbol, info, cnum| {
// Do not export mangled symbols from cdylibs and don't attempt to export compiler-builtins
// from any cdylib. The latter doesn't work anyway as we use hidden visibility for
// compiler-builtins. Most linkers silently ignore it, but ld64 gives a warning.
if info.level.is_below_threshold(export_threshold) && !tcx.is_compiler_builtins(cnum) {
symbols.push(symbol_export::exporting_symbol_name_for_instance_in_crate(
tcx, symbol, cnum,
symbols.push((
symbol_export::exporting_symbol_name_for_instance_in_crate(tcx, symbol, cnum),
info.kind,
));
symbol_export::extend_exported_symbols(&mut symbols, tcx, symbol, cnum);
symbol_export::extend_exported_symbols(&mut symbols, tcx, symbol, info, cnum);
}
});

symbols
}

fn exported_symbols_for_proc_macro_crate(tcx: TyCtxt<'_>) -> Vec<String> {
fn exported_symbols_for_proc_macro_crate(tcx: TyCtxt<'_>) -> Vec<(String, SymbolExportKind)> {
// `exported_symbols` will be empty when !should_codegen.
if !tcx.sess.opts.output_types.should_codegen() {
return Vec::new();
Expand All @@ -1809,7 +1848,10 @@ fn exported_symbols_for_proc_macro_crate(tcx: TyCtxt<'_>) -> Vec<String> {
let proc_macro_decls_name = tcx.sess.generate_proc_macro_decls_symbol(stable_crate_id);
let metadata_symbol_name = exported_symbols::metadata_symbol_name(tcx);

vec![proc_macro_decls_name, metadata_symbol_name]
vec![
(proc_macro_decls_name, SymbolExportKind::Text),
(metadata_symbol_name, SymbolExportKind::Text),
]
}

pub(crate) fn linked_symbols(
Expand All @@ -1831,7 +1873,9 @@ pub(crate) fn linked_symbols(
|| info.used
{
symbols.push((
symbol_export::linking_symbol_name_for_instance_in_crate(tcx, symbol, cnum),
symbol_export::linking_symbol_name_for_instance_in_crate(
tcx, symbol, info.kind, cnum,
),
info.kind,
));
}
Expand Down Expand Up @@ -1906,7 +1950,13 @@ impl<'a> Linker for PtxLinker<'a> {

fn ehcont_guard(&mut self) {}

fn export_symbols(&mut self, _tmpdir: &Path, _crate_type: CrateType, _symbols: &[String]) {}
fn export_symbols(
&mut self,
_tmpdir: &Path,
_crate_type: CrateType,
_symbols: &[(String, SymbolExportKind)],
) {
}

fn subsystem(&mut self, _subsystem: &str) {}

Expand Down Expand Up @@ -1975,10 +2025,15 @@ impl<'a> Linker for LlbcLinker<'a> {

fn ehcont_guard(&mut self) {}

fn export_symbols(&mut self, _tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
fn export_symbols(
&mut self,
_tmpdir: &Path,
_crate_type: CrateType,
symbols: &[(String, SymbolExportKind)],
) {
match _crate_type {
CrateType::Cdylib => {
for sym in symbols {
for (sym, _) in symbols {
self.link_args(&["--export-symbol", sym]);
}
}
Expand Down Expand Up @@ -2052,11 +2107,16 @@ impl<'a> Linker for BpfLinker<'a> {

fn ehcont_guard(&mut self) {}

fn export_symbols(&mut self, tmpdir: &Path, _crate_type: CrateType, symbols: &[String]) {
fn export_symbols(
&mut self,
tmpdir: &Path,
_crate_type: CrateType,
symbols: &[(String, SymbolExportKind)],
) {
let path = tmpdir.join("symbols");
let res: io::Result<()> = try {
let mut f = File::create_buffered(&path)?;
for sym in symbols {
for (sym, _) in symbols {
writeln!(f, "{sym}")?;
}
};
Expand Down
Loading
Loading