Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
2ca628e
loongarch: Add portable intrinsics::simd implementations for VAVG/VAV…
tangaac Jul 22, 2026
fcf4562
neon: drop the align requirement on vld1/vst1 lane loads and stores
valentynkit Aug 20, 2026
e9bc995
neon: drop the align requirement on vld1 dup loads
valentynkit Aug 20, 2026
2b05940
neon: assert ldr for the f32 lane and dup loads on arm
valentynkit Aug 20, 2026
98f513b
Add missing avx512vl intrinsics for f32->u32 conversions
Shnatsel Jul 26, 2026
773242f
Add manual exception for the intrinsics forgotten in the intel intrin…
Shnatsel Aug 23, 2026
d78d206
Use the proper tracking issue
Shnatsel Aug 23, 2026
9f02c53
cargo fmt
Shnatsel Aug 23, 2026
17c4c4f
Merge pull request #2197 from Shnatsel/missing-avx512vl-conversions
folkertdev Aug 23, 2026
f9fe5c5
Merge branch 'rust-lang:main' into loongarch-simd-vavg
tangaac Aug 24, 2026
2e36890
Prepare for merging from rust-lang/rust
invalid-email-address Aug 24, 2026
8d4eacf
Merge ref 'da5114692c9e' from rust-lang/rust
invalid-email-address Aug 24, 2026
7bd952b
Merge pull request #2203 from rust-lang/rustc-pull
adamgemmell Aug 24, 2026
8360819
Merge pull request #2195 from tangaac/loongarch-simd-vavg
adamgemmell Aug 24, 2026
2cc2b57
Prepare for merging from rust-lang/rust
invalid-email-address Sep 7, 2026
a3ff62c
Merge ref '32d94cc9be3f' from rust-lang/rust
invalid-email-address Sep 7, 2026
0016f59
Run rustfmt
adamgemmell Sep 7, 2026
7cbced2
Update vzipq arm instruction assertions
adamgemmell Sep 8, 2026
ab89d47
Merge pull request #2215 from rust-lang/rustc-pull
folkertdev Sep 8, 2026
0c4077d
Run cargo fmt on JOSH syncs
adamgemmell Sep 8, 2026
dd13995
Revert "Use SIMD intrinsics for vector shifts"
RalfJung Sep 5, 2026
39333b9
de-constify methods that depended on the vector shift ones
RalfJung Sep 5, 2026
aa62feb
fmt
RalfJung Sep 5, 2026
cfc12ac
Fix "explicit `package.readme` can be inferred"
adamgemmell Sep 9, 2026
89e9fe1
Fix "`package.homepage` is redundant with `package.repository`"
adamgemmell Sep 9, 2026
dce8dd2
Fix "unused dependency"
adamgemmell Sep 9, 2026
a5b1c3c
Merge pull request #2217 from RalfJung/vector-shift-codegen
adamgemmell Sep 9, 2026
aa1e431
Merge pull request #2220 from adamgemmell/dev/adagem01/josh-sync-fmt
folkertdev Sep 13, 2026
d3d4a64
only run `f16` tests when `target_has_reliable_f16`
folkertdev Sep 13, 2026
655ec5a
Merge pull request #2222 from adamgemmell/dev/adagem01/cargo-lints
folkertdev Sep 13, 2026
5bf69a2
Enable triagebot relabelling
clarfonthey Sep 13, 2026
dbac732
Merge pull request #2214 from valentynkit/vld1-lane-unaligned
Amanieu Sep 14, 2026
6c68a59
Merge pull request #2224 from folkertdev/win-gnu-no-f16
adamgemmell Sep 14, 2026
c18068c
Merge pull request #2223 from clarfonthey/triagebot
folkertdev Sep 14, 2026
8b69149
Use clap to parse arguments in `stdarch-gen-hexagon`
Kobzol Sep 14, 2026
d405672
Automatically reformat all generated files with a unified rustfmt config
Kobzol Sep 14, 2026
d0f6897
Use rustfmt formatting in stdarch-gen-loongarch
Kobzol Sep 14, 2026
2b0ee0b
Use unified rustfmt formatting in stdarch-gen-arm
Kobzol Sep 14, 2026
34bda05
Show diff when generated files do not match expectations
xonx4l Sep 14, 2026
988cc4b
Bless arm output
Kobzol Sep 14, 2026
1bda26e
Fix tests
Kobzol Sep 14, 2026
1d6ecb3
Install rustfmt on CI
Kobzol Sep 14, 2026
e358d1f
Merge pull request #2225 from Kobzol/gen-refactor-rustfmt
folkertdev Sep 14, 2026
4ff0ef6
intrinsic-test: Fix intrinsic test names for negative immediate values
heiher Sep 14, 2026
5a01034
intrinsic-test: Add C intrinsic name prefix support
heiher Sep 14, 2026
bb2b679
intrinsic-test: Support testing LoongArch64 SIMD intrinsics
heiher Sep 14, 2026
41bc79c
Merge pull request #2226 from heiher/loong64-intrinsic-test
folkertdev Sep 17, 2026
a998f8a
improve simd bitshift tests
folkertdev Sep 17, 2026
74a45da
Merge commit '39f626bc72757517b75d8e2dde50fa832b8d6c03'
GuillaumeGomez Sep 18, 2026
0787958
Fix source code divergence
GuillaumeGomez Sep 18, 2026
8d490ac
Remove forgotten file
GuillaumeGomez Sep 18, 2026
fcddd10
s390x: use funnel shift
folkertdev Sep 20, 2026
3da3866
s390x: use u128 arithmetic
folkertdev Sep 20, 2026
acc7501
gca: fix unreachable
khyperia Sep 21, 2026
e587f8b
Wire up f16b in backends
Jamesbarford Sep 21, 2026
fc49efd
Prepare for merging from rust-lang/rust
Kobzol Sep 21, 2026
20cdf9f
Merge ref '220b36c420c4' from rust-lang/rust
Kobzol Sep 21, 2026
dabd0d2
Merge pull request #2230 from folkertdev/s390x-llvm-fixmes
adamgemmell Sep 21, 2026
c263e3d
avoid accessing uninferred closure upvars in diagnostics
amirHdev Sep 10, 2026
6f61f25
Auto merge of #162499 - GuillaumeGomez:subtree-update_cg_gcc_2026-09-…
bors Sep 22, 2026
46d8bca
`use ConstExt` for methods that do not yet exist in `rustc_type_ir`
Jamesbarford Sep 17, 2026
0f6a381
Merge branch 'master' into sync_from_rust_2026_09_22
antoyo Sep 22, 2026
db0b931
Update to nightly-2026-09-22
antoyo Sep 22, 2026
7a8706e
Skip test_mm_srav_epi64 as it's broken upstream
antoyo Sep 22, 2026
f1e8ff5
Merge pull request #982 from rust-lang/sync_from_rust_2026_09_22
antoyo Sep 22, 2026
dc249dc
Add address_space and byref to abi PassMode::Indirect
Flakebi Sep 1, 2026
d9e4b39
Rename rust-toolchain to rust-toolchain.toml
Kobzol Sep 23, 2026
047bdcb
Update apt packages before installing them
Kobzol Sep 23, 2026
3ca6e6c
fix `test_mm_srav_epi64` shift direction
folkertdev Sep 23, 2026
75dd3ee
Merge pull request #2228 from folkertdev/better-simd-bitshift-tests
davidtwco Sep 23, 2026
d67606b
Update code to use the new file
Kobzol Sep 23, 2026
4282aee
Merge pull request #2231 from Kobzol/sync
folkertdev Sep 23, 2026
c962070
Merge pull request #983 from Kobzol/rename-rust-toolchain
antoyo Sep 23, 2026
18699a4
Merge branch 'master' into sync-2026-09-23
GuillaumeGomez Sep 23, 2026
603ca3f
Add regression tests for await macro suggestions
chenyukang Sep 24, 2026
3ea2995
Fix incorrect use of await in parser suggestion
chenyukang Sep 24, 2026
f8f1dc2
Enable EII tests for cg_gcc
AsakuraMizu Sep 23, 2026
67afe38
Update rustc version to `2026-09-24`
GuillaumeGomez Sep 23, 2026
5ed0180
Build a new incr comp session dir from scratch every time
bjorn3 Jul 8, 2026
ffb7eef
Merge pull request #984 from GuillaumeGomez/sync-2026-09-23
GuillaumeGomez Sep 24, 2026
8a11b81
Merge commit 'ffb7eef504d4d9507583825e8e411d283c4e357e'
GuillaumeGomez Sep 24, 2026
c1ce926
Rollup merge of #163218 - folkertdev:stdarch-sync-2026-09-23, r=folke…
JonathanBrouwer Sep 24, 2026
f0f6653
Rollup merge of #159287 - bjorn3:incr_comp_session_from_scratch, r=nn…
JonathanBrouwer Sep 24, 2026
04b9b7f
Rollup merge of #163222 - AsakuraMizu:eii-gcc, r=BoxyUwU,GuillaumeGomez
JonathanBrouwer Sep 24, 2026
03290b3
Rollup merge of #163251 - GuillaumeGomez:sybtree-sync-2026-09-24, r=G…
JonathanBrouwer Sep 24, 2026
be3bb9f
Rollup merge of #162595 - amirHdev:uninferred-upvars, r=lcnr
JonathanBrouwer Sep 24, 2026
a9ddedf
Rollup merge of #162937 - khyperia:gca-fix-unreachable, r=BoxyUwU
JonathanBrouwer Sep 24, 2026
8b09cf2
Rollup merge of #163238 - chenyukang:yukang-fix-await-macro-suggestio…
JonathanBrouwer Sep 24, 2026
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
1 change: 0 additions & 1 deletion compiler/rustc_codegen_cranelift/src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ fn emit_module(
bytecode: None,
assembly: None,
llvm_ir: None,
links_from_incr_cache: Vec::new(),
})
}

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_gcc/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ jobs:

- name: Install packages
# `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests.
run: sudo apt-get install ninja-build ripgrep llvm-14-tools llvm
run: |
sudo apt-get update
sudo apt-get install ninja-build ripgrep llvm-14-tools llvm

- name: Install the libraries needed to build librsvg
if: ${{ contains(matrix.commands, '--projects') }}
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ jobs:
if: ${{ !matrix.cargo_runner }}
run: |
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
./y.sh test --release --stdarch-tests -- --skip test_tile_ --skip test__tile
# FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream.
./y.sh test --release --stdarch-tests -- --skip test_tile_ --skip test__tile --skip test_mm_srav_epi64

- name: Run stdarch tests
if: ${{ matrix.cargo_runner }}
run: |
# FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro.
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
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
# FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream.
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

# Summary job for the merge queue.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ If you compiled `cg_gcc` in debug mode (aka you didn't pass `--release` to `./y.
You can do the same manually (although we don't recommend it):

```bash
$ 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
$ 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
```

## Environment variables
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/build_system/src/abi_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn run() -> Result<(), String> {
.map_err(|err| format!("Git clone failed with message: {err:?}!"))?;
// Configure abi-cafe to use the exact same rustc version we use - this is crucial.
// Otherwise, the concept of ABI compatibility becomes meanignless.
std::fs::copy("rust-toolchain", "clones/abi-cafe/rust-toolchain")
std::fs::copy("rust-toolchain.toml", "clones/abi-cafe/rust-toolchain.toml")
.expect("Could not copy toolchain configs!");
// Get the backend path.
// We will use the *debug* build of the backend - it has more checks enabled.
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_gcc/build_system/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ fn rustc_version_info_inner(
}

pub fn get_toolchain() -> Result<String, String> {
let content = match fs::read_to_string("rust-toolchain") {
let content = match fs::read_to_string("rust-toolchain.toml") {
Ok(content) => content,
Err(_) => return Err("No `rust-toolchain` file found".to_string()),
Err(_) => return Err("No `rust-toolchain.toml` file found".to_string()),
};
match content
.split('\n')
Expand All @@ -259,7 +259,7 @@ pub fn get_toolchain() -> Result<String, String> {
.next()
{
Some(toolchain) => Ok(toolchain.to_string()),
None => Err("Couldn't find `channel` in `rust-toolchain` file".to_string()),
None => Err("Couldn't find `channel` in `rust-toolchain.toml` file".to_string()),
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/doc/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ COLLECT_NO_DEMANGLE=1
### How to use a custom-build rustc

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

### How to use a custom sysroot source path

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2026-09-18"
channel = "nightly-2026-09-24"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
36 changes: 21 additions & 15 deletions compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,23 +463,29 @@ fn thin_lto(

info!("thin LTO data created");

let (key_map_path, prev_key_map, curr_key_map) = if let Some(ref incr_comp_session_dir) =
cgcx.incr_comp_session_dir
let new_key_map_path = cgcx
.new_incr_comp_session_dir
.as_ref()
.map(|dir| dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME));

let prev_key_map = if let Some(ref old_incr_comp_session_dir) =
cgcx.old_incr_comp_session_dir
{
let path = incr_comp_session_dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME);
let old_path = old_incr_comp_session_dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME);

// If the previous file was deleted, or we get an IO error
// reading the file, then we'll just use `None` as the
// prev_key_map, which will force the code to be recompiled.
let prev =
if path.exists() { ThinLTOKeysMap::load_from_file(&path).ok() } else { None };
let curr = ThinLTOKeysMap::from_thin_lto_modules(&data, &thin_modules, &module_names);
(Some(path), prev, curr)
if old_path.exists() { ThinLTOKeysMap::load_from_file(&old_path).ok() } else { None }
} else {
assert!(green_modules.is_empty());
None
};
let curr_key_map = if cgcx.new_incr_comp_session_dir.is_some() {
ThinLTOKeysMap::from_thin_lto_modules(&data, &thin_modules, &module_names)
} else {
// If we don't compile incrementally, we don't need to load the
// import data from LLVM.
assert!(green_modules.is_empty());
let curr = ThinLTOKeysMap::default();
(None, None, curr)
ThinLTOKeysMap::default()
};
info!("thin LTO cache key map loaded");
info!("prev_key_map: {:#?}", prev_key_map);
Expand All @@ -500,15 +506,15 @@ fn thin_lto(
if let (Some(prev_key_map), true) =
(prev_key_map.as_ref(), green_modules.contains_key(module_name))
{
assert!(cgcx.incr_comp_session_dir.is_some());
assert!(cgcx.old_incr_comp_session_dir.is_some());
assert!(cgcx.new_incr_comp_session_dir.is_some());

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

// Save the current ThinLTO import information for the next compilation
// session, overwriting the previous serialized data (if any).
if let Some(path) = key_map_path
// session.
if let Some(path) = new_key_map_path
&& let Err(err) = curr_key_map.save_to_file(&path)
{
write::llvm_err(dcx, LlvmError::WriteThinLtoKey { err });
Expand Down
50 changes: 34 additions & 16 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use rustc_errors::{
Level, MultiSpan, Style, Sublevel, Suggestions, catch_fatal_errors,
};
use rustc_fs_util::link_or_copy;
use rustc_incremental::{copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir_sess};
use rustc_incremental::{
copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir_sess, in_old_incr_comp_dir_sess,
};
use rustc_macros::{Decodable, Encodable};
use rustc_metadata::fs::copy_to_stdout;
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
Expand Down Expand Up @@ -351,9 +353,12 @@ pub struct CodegenContext {
/// Directory into which should the LLVM optimization remarks be written.
/// If `None`, they will be written to stderr.
pub remark_dir: Option<PathBuf>,
/// The previous incremental compilation session directory, or None if we
/// are not compiling incrementally or there is no previous session.
pub old_incr_comp_session_dir: Option<PathBuf>,
/// The incremental compilation session directory, or None if we are not
/// compiling incrementally
pub incr_comp_session_dir: Option<PathBuf>,
pub new_incr_comp_session_dir: Option<PathBuf>,
/// `Some(limit)` if the codegen should be run in parallel.
///
/// Depends on [`WriteBackendMethods::supports_parallel()`] and `--jobs-backend`.
Expand Down Expand Up @@ -497,7 +502,6 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
incr_comp_session.unwrap(),
&module.name,
files.as_slice(),
&module.links_from_incr_cache,
);
work_products.insert(id, product);
}
Expand Down Expand Up @@ -839,7 +843,7 @@ fn execute_optimize_work_item<B: WriteBackendMethods>(
// save our module to disk first.
let bitcode = if cgcx.module_config.emit_pre_lto_bc {
let filename = pre_lto_bitcode_filename(&module.name);
cgcx.incr_comp_session_dir.as_ref().map(|path| path.join(&filename))
cgcx.new_incr_comp_session_dir.as_ref().map(|path| path.join(&filename))
} else {
None
};
Expand Down Expand Up @@ -886,11 +890,9 @@ fn execute_copy_from_cache_work_item(
let dcx = DiagCtxt::new(Box::new(shared_emitter));
let dcx = dcx.handle();

let incr_comp_session_dir = cgcx.incr_comp_session_dir.as_ref().unwrap();

let mut links_from_incr_cache = Vec::new();
let incr_comp_session_dir = cgcx.old_incr_comp_session_dir.as_ref().unwrap();

let mut load_from_incr_comp_dir = |output_path: PathBuf, saved_path: &str| {
let load_from_incr_comp_dir = |output_path: PathBuf, saved_path: &str| {
let source_file_in_incr_comp_dir = incr_comp_session_dir.join(saved_path);
debug!(
"copying preexisting module `{}` from {:?} to {}",
Expand All @@ -899,10 +901,7 @@ fn execute_copy_from_cache_work_item(
output_path.display()
);
match link_or_copy(&source_file_in_incr_comp_dir, &output_path) {
Ok(_) => {
links_from_incr_cache.push(source_file_in_incr_comp_dir);
Some(output_path)
}
Ok(_) => Some(output_path),
Err(error) => {
dcx.emit_err(diagnostics::CopyPathBuf {
source_file: source_file_in_incr_comp_dir,
Expand All @@ -925,7 +924,7 @@ fn execute_copy_from_cache_work_item(
load_from_incr_comp_dir(dwarf_obj_out, saved_dwarf_object_file)
});

let mut load_from_incr_cache = |perform, output_type: OutputType| {
let load_from_incr_cache = |perform, output_type: OutputType| {
if perform {
let saved_file = module.source.saved_files.get(output_type.extension())?;
let output_path = cgcx.output_filenames.temp_path_for_cgu(output_type, &module.name);
Expand Down Expand Up @@ -953,7 +952,6 @@ fn execute_copy_from_cache_work_item(
}

CompiledModule {
links_from_incr_cache,
kind: ModuleKind::Regular,
name: module.name,
object,
Expand Down Expand Up @@ -1293,10 +1291,15 @@ fn start_executing_work<B: WriteBackendMethods>(
time_trace: sess.opts.unstable_opts.llvm_time_trace,
remark: sess.opts.cg.remark.clone(),
remark_dir,
incr_comp_session_dir: tcx
old_incr_comp_session_dir: tcx
.incr_comp_session
.as_ref()
.and_then(|incr_comp_session| incr_comp_session.old_session_directory.as_deref())
.map(ToOwned::to_owned),
new_incr_comp_session_dir: tcx
.incr_comp_session
.as_ref()
.map(|incr_comp_session| (&*incr_comp_session.session_directory).to_owned()),
.map(|incr_comp_session| (&*incr_comp_session.new_session_directory).to_owned()),
output_filenames: Arc::clone(tcx.output_filenames(())),
module_config: regular_config,
opt_level,
Expand Down Expand Up @@ -2260,7 +2263,22 @@ pub(crate) fn submit_pre_lto_module_to_llvm<B: WriteBackendMethods>(
module: CachedModuleCodegen,
) {
let filename = pre_lto_bitcode_filename(&module.name);
let old_bitcode_path =
in_old_incr_comp_dir_sess(tcx.incr_comp_session.unwrap(), &filename).unwrap();
let bitcode_path = in_incr_comp_dir_sess(tcx.incr_comp_session.unwrap(), &filename);

match link_or_copy(&old_bitcode_path, &bitcode_path) {
Ok(_) => {}
Err(error) => {
tcx.sess.dcx().emit_err(diagnostics::CopyPathBuf {
source_file: old_bitcode_path,
output_path: bitcode_path,
error,
});
return;
}
}

// Schedule the module to be loaded
drop(
coordinator
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,10 @@ pub fn codegen_crate<
source: cgu.previous_work_product(tcx),
},
);
// This will unwind if there are errors, which triggers our `AbortCodegenOnDrop`
// guard. Unfortunately, just skipping the `submit_pre_lto_module_to_llvm` makes
// compilation hang on post-monomorphization errors.
tcx.dcx().abort_if_errors();
}
CguReuse::PostLto => {
submit_post_lto_module_to_llvm(
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ impl<M> ModuleCodegen<M> {
bytecode,
assembly,
llvm_ir,
links_from_incr_cache: Vec::new(),
}
}
}
Expand All @@ -129,7 +128,6 @@ pub struct CompiledModule {
pub bytecode: Option<PathBuf>,
pub assembly: Option<PathBuf>, // --emit=asm
pub llvm_ir: Option<PathBuf>, // --emit=llvm-ir, llvm-bc is in bytecode
pub links_from_incr_cache: Vec<PathBuf>,
}

impl CompiledModule {
Expand Down
22 changes: 0 additions & 22 deletions compiler/rustc_incremental/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,6 @@ pub(crate) struct DeleteLock<'a> {
pub err: std::io::Error,
}

#[derive(Diagnostic)]
#[diag(
"hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `{$path}`"
)]
pub(crate) struct HardLinkFailed<'a> {
pub path: &'a Path,
}

#[derive(Diagnostic)]
#[diag("failed to delete partly initialized session dir `{$path}`: {$err}")]
pub(crate) struct DeletePartial<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}

#[derive(Diagnostic)]
#[diag("did not finalize incremental compilation session directory `{$path}`: {$err}")]
#[help("the next build will not be able to reuse work from this compilation")]
Expand Down Expand Up @@ -266,13 +251,6 @@ pub(crate) struct CopyWorkProductToCache<'a> {
pub err: std::io::Error,
}

#[derive(Diagnostic)]
#[diag("file-system error deleting outdated file `{$path}`: {$err}")]
pub(crate) struct DeleteWorkProduct<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}

#[derive(Diagnostic)]
#[diag(
"corrupt incremental compilation artifact found at `{$path}`. This file will automatically be ignored and deleted. If you see this message repeatedly or can provoke it without manually manipulating the compiler's artifacts, please file an issue. The incremental compilation system relies on hardlinks and filesystem locks behaving correctly, and may not deal well with OS crashes, so whatever information you can provide about your filesystem or other state may be very relevant"
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_incremental/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// tidy-alphabetical-start
#![deny(missing_docs)]
#![feature(file_buffered)]
#![feature(try_blocks)]
// tidy-alphabetical-end

mod assert_dep_graph;
Expand All @@ -11,7 +12,7 @@ mod persist;

pub use persist::{
copy_cgu_workproduct_to_incr_comp_cache_dir, finalize_session_directory, in_incr_comp_dir_sess,
load_query_result_cache, save_work_product_index, setup_dep_graph,
in_old_incr_comp_dir_sess, load_query_result_cache, save_work_product_index, setup_dep_graph,
};
use rustc_middle::util::Providers;

Expand Down
Loading
Loading