Skip to content

cargo check fails only in incremental mode #58291

Closed
@matklad

Description

@matklad

I think I see a behavior where incremental compilation introduce a spurious compiler error.

The code is rust-lang/rust-analyzer@9798463.

I run cargo check and env CARGO_INCREMENTAL=0 cargo check in crates/ra_ide_api directory.

The first (incremental) fails with

[E0599]
    Checking ra_arena v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_arena)
    Checking ra_tt v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_tt)
    Checking test_utils v0.1.0 (/home/matklad/projects/rust-analyzer/crates/test_utils)
    Checking ra_text_edit v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_text_edit)
    Checking ra_syntax v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_syntax)
    Checking ra_mbe v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_mbe)
    Checking ra_db v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_db)
    Checking ra_ide_api_light v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_ide_api_light)
    Checking ra_hir v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_hir)
    Checking ra_assists v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_assists)
    Checking ra_ide_api v0.1.0 (/home/matklad/projects/rust-analyzer/crates/ra_ide_api)
error[E0599]: no method named `file_text` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:219:17
    |
219 |         self.db.file_text(file_id)
    |                 ^^^^^^^^^
    |
    = note: the method `file_text` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `file_text`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:224:17
    |
224 |         self.db.parse(file_id).clone()
    |                 ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:241:28
    |
241 |         let file = self.db.parse(position.file_id);
    |                            ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:248:28
    |
248 |         let file = self.db.parse(file_id);
    |                            ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:255:28
    |
255 |         let file = self.db.parse(frange.file_id);
    |                            ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:265:28
    |
265 |         let file = self.db.parse(position.file_id);
    |                            ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:274:28
    |
274 |         let file = self.db.parse(position.file_id);
    |                            ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:281:28
    |
281 |         let file = self.db.parse(position.file_id);
    |                            ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:289:28
    |
289 |         let file = self.db.parse(file_id);
    |                            ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `salsa::Snapshot<db::RootDatabase>` in the current scope
   --> crates/ra_ide_api/src/lib.rs:295:28
    |
295 |         let file = self.db.parse(file_id);
    |                            ^^^^^
    |
    = note: the method `parse` exists but the following trait bounds were not satisfied:
            `salsa::Snapshot<db::RootDatabase> : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `parse`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `crate_graph` found for type `&db::RootDatabase` in the current scope
   --> crates/ra_ide_api/src/lib.rs:350:30
    |
350 |         self.with_db(|db| db.crate_graph().crate_root(crate_id))
    |                              ^^^^^^^^^^^
    |
    = note: the method `crate_graph` exists but the following trait bounds were not satisfied:
            `db::RootDatabase : ra_db::SourceDatabase`
            `&db::RootDatabase : ra_db::SourceDatabase`
            `db::RootDatabase : ra_db::SourceDatabase`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `crate_graph`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `&db::RootDatabase` in the current scope
  --> crates/ra_ide_api/src/goto_definition.rs:15:19
   |
15 |     let file = db.parse(position.file_id);
   |                   ^^^^^
   |
   = note: the method `parse` exists but the following trait bounds were not satisfied:
           `db::RootDatabase : ra_db::SourceDatabase`
           `&db::RootDatabase : ra_db::SourceDatabase`
           `db::RootDatabase : ra_db::SourceDatabase`
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `parse`, perhaps you need to implement it:
           candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `&db::RootDatabase` in the current scope
  --> crates/ra_ide_api/src/hover.rs:10:19
   |
10 |     let file = db.parse(position.file_id);
   |                   ^^^^^
   |
   = note: the method `parse` exists but the following trait bounds were not satisfied:
           `db::RootDatabase : ra_db::SourceDatabase`
           `&db::RootDatabase : ra_db::SourceDatabase`
           `db::RootDatabase : ra_db::SourceDatabase`
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `parse`, perhaps you need to implement it:
           candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `parse` found for type `&db::RootDatabase` in the current scope
  --> crates/ra_ide_api/src/impls.rs:14:19
   |
14 |     let file = db.parse(position.file_id);
   |                   ^^^^^
   |
   = note: the method `parse` exists but the following trait bounds were not satisfied:
           `db::RootDatabase : ra_db::SourceDatabase`
           `&db::RootDatabase : ra_db::SourceDatabase`
           `db::RootDatabase : ra_db::SourceDatabase`
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `parse`, perhaps you need to implement it:
           candidate #1: `ra_db::SourceDatabase`

error: aborting due to 14 previous errors

For more information about this error, try `rustc --explain E0599`.
error: Could not compile `ra_ide_api`.

To learn more, run the command again with --verbose.

The second (non-incremental) exists successfully.

Metadata

Metadata

Assignees

Labels

A-incr-compArea: Incremental compilationA-trait-systemArea: Trait systemC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions