Skip to content
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

Incremental compilation and codegen that produces no object files #123234

Closed
pacak opened this issue Mar 30, 2024 · 0 comments · Fixed by #124023
Closed

Incremental compilation and codegen that produces no object files #123234

pacak opened this issue Mar 30, 2024 · 0 comments · Fixed by #124023
Labels
A-codegen Area: Code generation A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pacak
Copy link
Contributor

pacak commented Mar 30, 2024

It is possible to ask rustc to produce intermediate files (assembly, llvm-ir) without asking to produce object files. This works fine as long as incremental compilation is disabled. Once it is enabled - it fails in all sorts of ways - multiple asserts and with those removed - it fails to restore intermediate product from the cache since they are not cached (#123221 deals with that).

rm -rf *
touch lib.rs
rustc --emit asm --crate-type lib lib.rs -C incremental=foo
rustc --emit asm --crate-type lib lib.rs -C incremental=foo 

Fails with this (and more)

thread 'cpy tzqeezh2sedvpj0' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_codegen_ssa/src/back/write.rs:890:5:
assertion failed: module_config.emit_obj != EmitObj::None

Options are:

  1. remove the asserts or allow them to pass if user never asked for object code in the first place
  2. change the logic such that requesting for byproducts implies request for object files
@pacak pacak added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 30, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 30, 2024
@jieyouxu jieyouxu added A-codegen Area: Code generation A-incr-comp Area: Incremental compilation and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 30, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 16, 2024
Allow workproducts without object files.

This pull request partially reverts changes from e16c3b4

Original motivation for this assert was described with "A WorkProduct without a saved file is useless"
which was true at the time but now it is possible to have work products with other types of files
(llvm-ir, asm, etc) and there are bugreports for this failure:

For example: rust-lang#123695

Fixes rust-lang#123234

Now existing `assert` and `.unwrap_or_else` are unified into a single
check that emits slightly more user friendly error message if an object
files was meant to be produced but it's missing
@bors bors closed this as completed in a03aeca Apr 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 16, 2024
Rollup merge of rust-lang#124023 - pacak:less-splody, r=jieyouxu

Allow workproducts without object files.

This pull request partially reverts changes from e16c3b4

Original motivation for this assert was described with "A WorkProduct without a saved file is useless"
which was true at the time but now it is possible to have work products with other types of files
(llvm-ir, asm, etc) and there are bugreports for this failure:

For example: rust-lang#123695

Fixes rust-lang#123234

Now existing `assert` and `.unwrap_or_else` are unified into a single
check that emits slightly more user friendly error message if an object
files was meant to be produced but it's missing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants