Skip to content

Commit f340ff6

Browse files
committed
Auto merge of #163265 - JonathanBrouwer:rollup-RZQ8eQg, r=JonathanBrouwer
Rollup of 7 pull requests Successful merges: - #163218 (stdarch subtree update) - #159287 (Build a new incr comp session dir from scratch every time) - #163222 (Enable EII tests for cg_gcc) - #163251 (cg_gcc subtree sync 2026-09-24) - #162595 (avoid accessing uninferred closure upvars in diagnostics) - #162937 (do generic_const_args Const::Ty hack only on projection consts) - #163238 (Fix incorrect use of await in parser suggestion)
2 parents 2350b22 + 8b09cf2 commit f340ff6

141 files changed

Lines changed: 2457 additions & 1172 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎compiler/rustc_codegen_cranelift/src/driver/aot.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ fn emit_module(
140140
bytecode: None,
141141
assembly: None,
142142
llvm_ir: None,
143-
links_from_incr_cache: Vec::new(),
144143
})
145144
}
146145

‎compiler/rustc_codegen_gcc/.github/workflows/ci.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ jobs:
5252

5353
- name: Install packages
5454
# `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests.
55-
run: sudo apt-get install ninja-build ripgrep llvm-14-tools llvm
55+
run: |
56+
sudo apt-get update
57+
sudo apt-get install ninja-build ripgrep llvm-14-tools llvm
5658
5759
- name: Install the libraries needed to build librsvg
5860
if: ${{ contains(matrix.commands, '--projects') }}

‎compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,16 @@ jobs:
9696
if: ${{ !matrix.cargo_runner }}
9797
run: |
9898
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
99-
./y.sh test --release --stdarch-tests -- --skip test_tile_ --skip test__tile
99+
# FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream.
100+
./y.sh test --release --stdarch-tests -- --skip test_tile_ --skip test__tile --skip test_mm_srav_epi64
100101
101102
- name: Run stdarch tests
102103
if: ${{ matrix.cargo_runner }}
103104
run: |
104105
# FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro.
105106
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
106-
STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64" STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_tile_ --skip test__tile
107+
# FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream.
108+
STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64" STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_tile_ --skip test__tile --skip test_mm_srav_epi64
107109
108110
# Summary job for the merge queue.
109111
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!

‎compiler/rustc_codegen_gcc/Readme.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ If you compiled `cg_gcc` in debug mode (aka you didn't pass `--release` to `./y.
154154
You can do the same manually (although we don't recommend it):
155155

156156
```bash
157-
$ LIBRARY_PATH="[gcc-path value]" LD_LIBRARY_PATH="[gcc-path value]" rustc +$(cat $CG_GCCJIT_DIR/rust-toolchain | grep 'channel' | cut -d '=' -f 2 | sed 's/"//g' | sed 's/ //g') -Cpanic=abort -Zcodegen-backend=$CG_GCCJIT_DIR/target/release/librustc_codegen_gcc.so --sysroot $CG_GCCJIT_DIR/build_sysroot/sysroot my_crate.rs
157+
$ LIBRARY_PATH="[gcc-path value]" LD_LIBRARY_PATH="[gcc-path value]" rustc +$(cat $CG_GCCJIT_DIR/rust-toolchain.toml | grep 'channel' | cut -d '=' -f 2 | sed 's/"//g' | sed 's/ //g') -Cpanic=abort -Zcodegen-backend=$CG_GCCJIT_DIR/target/release/librustc_codegen_gcc.so --sysroot $CG_GCCJIT_DIR/build_sysroot/sysroot my_crate.rs
158158
```
159159

160160
## Environment variables

‎compiler/rustc_codegen_gcc/build_system/src/abi_test.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn run() -> Result<(), String> {
3434
.map_err(|err| format!("Git clone failed with message: {err:?}!"))?;
3535
// Configure abi-cafe to use the exact same rustc version we use - this is crucial.
3636
// Otherwise, the concept of ABI compatibility becomes meanignless.
37-
std::fs::copy("rust-toolchain", "clones/abi-cafe/rust-toolchain")
37+
std::fs::copy("rust-toolchain.toml", "clones/abi-cafe/rust-toolchain.toml")
3838
.expect("Could not copy toolchain configs!");
3939
// Get the backend path.
4040
// We will use the *debug* build of the backend - it has more checks enabled.

‎compiler/rustc_codegen_gcc/build_system/src/utils.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ fn rustc_version_info_inner(
242242
}
243243

244244
pub fn get_toolchain() -> Result<String, String> {
245-
let content = match fs::read_to_string("rust-toolchain") {
245+
let content = match fs::read_to_string("rust-toolchain.toml") {
246246
Ok(content) => content,
247-
Err(_) => return Err("No `rust-toolchain` file found".to_string()),
247+
Err(_) => return Err("No `rust-toolchain.toml` file found".to_string()),
248248
};
249249
match content
250250
.split('\n')
@@ -259,7 +259,7 @@ pub fn get_toolchain() -> Result<String, String> {
259259
.next()
260260
{
261261
Some(toolchain) => Ok(toolchain.to_string()),
262-
None => Err("Couldn't find `channel` in `rust-toolchain` file".to_string()),
262+
None => Err("Couldn't find `channel` in `rust-toolchain.toml` file".to_string()),
263263
}
264264
}
265265

‎compiler/rustc_codegen_gcc/doc/tips.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ COLLECT_NO_DEMANGLE=1
4141
### How to use a custom-build rustc
4242

4343
* Build the stage2 compiler (`rustup toolchain link debug-current build/x86_64-unknown-linux-gnu/stage2`).
44-
* Clean and rebuild the codegen with `debug-current` in the file `rust-toolchain`.
44+
* Clean and rebuild the codegen with `debug-current` in the file `rust-toolchain.toml`.
4545

4646
### How to use a custom sysroot source path
4747

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2026-09-18"
2+
channel = "nightly-2026-09-24"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

‎compiler/rustc_codegen_llvm/src/back/lto.rs‎

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -463,23 +463,29 @@ fn thin_lto(
463463

464464
info!("thin LTO data created");
465465

466-
let (key_map_path, prev_key_map, curr_key_map) = if let Some(ref incr_comp_session_dir) =
467-
cgcx.incr_comp_session_dir
466+
let new_key_map_path = cgcx
467+
.new_incr_comp_session_dir
468+
.as_ref()
469+
.map(|dir| dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME));
470+
471+
let prev_key_map = if let Some(ref old_incr_comp_session_dir) =
472+
cgcx.old_incr_comp_session_dir
468473
{
469-
let path = incr_comp_session_dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME);
474+
let old_path = old_incr_comp_session_dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME);
475+
470476
// If the previous file was deleted, or we get an IO error
471477
// reading the file, then we'll just use `None` as the
472478
// prev_key_map, which will force the code to be recompiled.
473-
let prev =
474-
if path.exists() { ThinLTOKeysMap::load_from_file(&path).ok() } else { None };
475-
let curr = ThinLTOKeysMap::from_thin_lto_modules(&data, &thin_modules, &module_names);
476-
(Some(path), prev, curr)
479+
if old_path.exists() { ThinLTOKeysMap::load_from_file(&old_path).ok() } else { None }
480+
} else {
481+
assert!(green_modules.is_empty());
482+
None
483+
};
484+
let curr_key_map = if cgcx.new_incr_comp_session_dir.is_some() {
485+
ThinLTOKeysMap::from_thin_lto_modules(&data, &thin_modules, &module_names)
477486
} else {
478-
// If we don't compile incrementally, we don't need to load the
479-
// import data from LLVM.
480487
assert!(green_modules.is_empty());
481-
let curr = ThinLTOKeysMap::default();
482-
(None, None, curr)
488+
ThinLTOKeysMap::default()
483489
};
484490
info!("thin LTO cache key map loaded");
485491
info!("prev_key_map: {:#?}", prev_key_map);
@@ -500,15 +506,15 @@ fn thin_lto(
500506
if let (Some(prev_key_map), true) =
501507
(prev_key_map.as_ref(), green_modules.contains_key(module_name))
502508
{
503-
assert!(cgcx.incr_comp_session_dir.is_some());
509+
assert!(cgcx.old_incr_comp_session_dir.is_some());
510+
assert!(cgcx.new_incr_comp_session_dir.is_some());
504511

505512
// If a module exists in both the current and the previous session,
506513
// and has the same LTO cache key in both sessions, then we can re-use it
507514
if prev_key_map.keys.get(module_name) == curr_key_map.keys.get(module_name) {
508515
let work_product = green_modules[module_name].clone();
509516
copy_jobs.push(work_product);
510517
info!(" - {}: re-used", module_name);
511-
assert!(cgcx.incr_comp_session_dir.is_some());
512518
continue;
513519
}
514520
}
@@ -518,8 +524,8 @@ fn thin_lto(
518524
}
519525

520526
// Save the current ThinLTO import information for the next compilation
521-
// session, overwriting the previous serialized data (if any).
522-
if let Some(path) = key_map_path
527+
// session.
528+
if let Some(path) = new_key_map_path
523529
&& let Err(err) = curr_key_map.save_to_file(&path)
524530
{
525531
write::llvm_err(dcx, LlvmError::WriteThinLtoKey { err });

‎compiler/rustc_codegen_ssa/src/back/write.rs‎

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ use rustc_errors::{
1515
Level, MultiSpan, Style, Sublevel, Suggestions, catch_fatal_errors,
1616
};
1717
use rustc_fs_util::link_or_copy;
18-
use rustc_incremental::{copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir_sess};
18+
use rustc_incremental::{
19+
copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir_sess, in_old_incr_comp_dir_sess,
20+
};
1921
use rustc_macros::{Decodable, Encodable};
2022
use rustc_metadata::fs::copy_to_stdout;
2123
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
@@ -351,9 +353,12 @@ pub struct CodegenContext {
351353
/// Directory into which should the LLVM optimization remarks be written.
352354
/// If `None`, they will be written to stderr.
353355
pub remark_dir: Option<PathBuf>,
356+
/// The previous incremental compilation session directory, or None if we
357+
/// are not compiling incrementally or there is no previous session.
358+
pub old_incr_comp_session_dir: Option<PathBuf>,
354359
/// The incremental compilation session directory, or None if we are not
355360
/// compiling incrementally
356-
pub incr_comp_session_dir: Option<PathBuf>,
361+
pub new_incr_comp_session_dir: Option<PathBuf>,
357362
/// `Some(limit)` if the codegen should be run in parallel.
358363
///
359364
/// Depends on [`WriteBackendMethods::supports_parallel()`] and `--jobs-backend`.
@@ -497,7 +502,6 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
497502
incr_comp_session.unwrap(),
498503
&module.name,
499504
files.as_slice(),
500-
&module.links_from_incr_cache,
501505
);
502506
work_products.insert(id, product);
503507
}
@@ -839,7 +843,7 @@ fn execute_optimize_work_item<B: WriteBackendMethods>(
839843
// save our module to disk first.
840844
let bitcode = if cgcx.module_config.emit_pre_lto_bc {
841845
let filename = pre_lto_bitcode_filename(&module.name);
842-
cgcx.incr_comp_session_dir.as_ref().map(|path| path.join(&filename))
846+
cgcx.new_incr_comp_session_dir.as_ref().map(|path| path.join(&filename))
843847
} else {
844848
None
845849
};
@@ -886,11 +890,9 @@ fn execute_copy_from_cache_work_item(
886890
let dcx = DiagCtxt::new(Box::new(shared_emitter));
887891
let dcx = dcx.handle();
888892

889-
let incr_comp_session_dir = cgcx.incr_comp_session_dir.as_ref().unwrap();
890-
891-
let mut links_from_incr_cache = Vec::new();
893+
let incr_comp_session_dir = cgcx.old_incr_comp_session_dir.as_ref().unwrap();
892894

893-
let mut load_from_incr_comp_dir = |output_path: PathBuf, saved_path: &str| {
895+
let load_from_incr_comp_dir = |output_path: PathBuf, saved_path: &str| {
894896
let source_file_in_incr_comp_dir = incr_comp_session_dir.join(saved_path);
895897
debug!(
896898
"copying preexisting module `{}` from {:?} to {}",
@@ -899,10 +901,7 @@ fn execute_copy_from_cache_work_item(
899901
output_path.display()
900902
);
901903
match link_or_copy(&source_file_in_incr_comp_dir, &output_path) {
902-
Ok(_) => {
903-
links_from_incr_cache.push(source_file_in_incr_comp_dir);
904-
Some(output_path)
905-
}
904+
Ok(_) => Some(output_path),
906905
Err(error) => {
907906
dcx.emit_err(diagnostics::CopyPathBuf {
908907
source_file: source_file_in_incr_comp_dir,
@@ -925,7 +924,7 @@ fn execute_copy_from_cache_work_item(
925924
load_from_incr_comp_dir(dwarf_obj_out, saved_dwarf_object_file)
926925
});
927926

928-
let mut load_from_incr_cache = |perform, output_type: OutputType| {
927+
let load_from_incr_cache = |perform, output_type: OutputType| {
929928
if perform {
930929
let saved_file = module.source.saved_files.get(output_type.extension())?;
931930
let output_path = cgcx.output_filenames.temp_path_for_cgu(output_type, &module.name);
@@ -953,7 +952,6 @@ fn execute_copy_from_cache_work_item(
953952
}
954953

955954
CompiledModule {
956-
links_from_incr_cache,
957955
kind: ModuleKind::Regular,
958956
name: module.name,
959957
object,
@@ -1293,10 +1291,15 @@ fn start_executing_work<B: WriteBackendMethods>(
12931291
time_trace: sess.opts.unstable_opts.llvm_time_trace,
12941292
remark: sess.opts.cg.remark.clone(),
12951293
remark_dir,
1296-
incr_comp_session_dir: tcx
1294+
old_incr_comp_session_dir: tcx
1295+
.incr_comp_session
1296+
.as_ref()
1297+
.and_then(|incr_comp_session| incr_comp_session.old_session_directory.as_deref())
1298+
.map(ToOwned::to_owned),
1299+
new_incr_comp_session_dir: tcx
12971300
.incr_comp_session
12981301
.as_ref()
1299-
.map(|incr_comp_session| (&*incr_comp_session.session_directory).to_owned()),
1302+
.map(|incr_comp_session| (&*incr_comp_session.new_session_directory).to_owned()),
13001303
output_filenames: Arc::clone(tcx.output_filenames(())),
13011304
module_config: regular_config,
13021305
opt_level,
@@ -2260,7 +2263,22 @@ pub(crate) fn submit_pre_lto_module_to_llvm<B: WriteBackendMethods>(
22602263
module: CachedModuleCodegen,
22612264
) {
22622265
let filename = pre_lto_bitcode_filename(&module.name);
2266+
let old_bitcode_path =
2267+
in_old_incr_comp_dir_sess(tcx.incr_comp_session.unwrap(), &filename).unwrap();
22632268
let bitcode_path = in_incr_comp_dir_sess(tcx.incr_comp_session.unwrap(), &filename);
2269+
2270+
match link_or_copy(&old_bitcode_path, &bitcode_path) {
2271+
Ok(_) => {}
2272+
Err(error) => {
2273+
tcx.sess.dcx().emit_err(diagnostics::CopyPathBuf {
2274+
source_file: old_bitcode_path,
2275+
output_path: bitcode_path,
2276+
error,
2277+
});
2278+
return;
2279+
}
2280+
}
2281+
22642282
// Schedule the module to be loaded
22652283
drop(
22662284
coordinator

0 commit comments

Comments
 (0)