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 Compile Bug On Moved Imports #104874

Open
tustvold opened this issue Nov 25, 2022 · 1 comment
Open

Incremental Compile Bug On Moved Imports #104874

tustvold opened this issue Nov 25, 2022 · 1 comment
Labels
A-incr-comp Area: Incremental compilation A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-bug Category: This is a bug. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tustvold
Copy link

tustvold commented Nov 25, 2022

Whilst working on https://github.com/apache/arrow-rs I keep running into issues where incremental compilation gets confused by types that have been moved from one crate within the workspace to another.

I'm not really sure how to come up with a reproducer, as it seems to rely on stale state from previous builds that I can't find a way to reproduce. However, @carols10cents recommended I file an issue to at least alert you guys that something isn't quite right 😅

An example error would be

$ cargo check
    Checking arrow-array v27.0.0 (/home/raphael/repos/external/arrow-rs/arrow-array)

error[E0432]: unresolved imports `arrow_schema::DECIMAL128_MAX_PRECISION`, `arrow_schema::DECIMAL128_MAX_SCALE`, `arrow_schema::DECIMAL256_MAX_PRECISION`, `arrow_schema::DECIMAL256_MAX_SCALE`, `arrow_schema::DECIMAL_DEFAULT_SCALE`
  --> arrow-array/src/types.rs:26:51
   |
26 |     ArrowError, DataType, IntervalUnit, TimeUnit, DECIMAL128_MAX_PRECISION,
   |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^ no `DECIMAL128_MAX_PRECISION` in the root
27 |     DECIMAL128_MAX_SCALE, DECIMAL256_MAX_PRECISION, DECIMAL256_MAX_SCALE,
   |     ^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^ no `DECIMAL256_MAX_SCALE` in the root
   |     |                     |
   |     |                     no `DECIMAL256_MAX_PRECISION` in the root
   |     no `DECIMAL128_MAX_SCALE` in the root
28 |     DECIMAL_DEFAULT_SCALE,
   |     ^^^^^^^^^^^^^^^^^^^^^ no `DECIMAL_DEFAULT_SCALE` in the root

Related to apache/arrow-rs#3177

And goes away with a cargo clean.

Edit: Interestingly it didn't appear to recompile any of the dependent crates, such as arrow-data, despite the fact they have changed... Perhaps this is a cargo bug??

Meta

rustc --version --verbose:

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: x86_64-unknown-linux-gnu
release: 1.65.0
LLVM version: 15.0.0
@tustvold tustvold added the C-bug Category: This is a bug. label Nov 25, 2022
@fmease fmease added A-resolve Area: Name/path resolution done by `rustc_resolve` specifically T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-incr-comp Area: Incremental compilation S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. and removed needs-triage-legacy labels Jan 26, 2024
@swarmer
Copy link

swarmer commented Sep 11, 2024

I'm hitting what seems to be a similar bug daily. But in my case I think it's not moved items but rather simply new items (structs, methods) that end up unresolved because the compiler seems to use some stale cache from another branch. cargo clean fixes it. I can't share the project, and I'm not sure how to reproduce this except that it happens after switching branches in a workspace.

After reading this issue, I'm realizing that this may, in fact, always be happening across workspace's crate boundaries for me, but I'm not sure, I'll pay more attention to whether it's always the case.

rustc --version --verbose

rustc 1.80.1 (3f5fd8dd4 2024-08-06)
binary: rustc
commit-hash: 3f5fd8dd41153bc5fdca9427e9e05be2c767ba23
commit-date: 2024-08-06
host: aarch64-apple-darwin
release: 1.80.1
LLVM version: 18.1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-bug Category: This is a bug. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants