Skip to content

Incremental compilation causes build to fail #826

Closed
@vipentti

Description

@vipentti

Currently when editing crates that contain / use salsa? related things, compilation may fail.

I have noticed this when editing ra_ide_api and ra_batch crates. This may occur with other crates as well.

This issue is not directly caused by rust-analyzer, however since it keeps occurring when working on the the project I thought it may be useful to have a tracking issue here as well.

This is reported in rust-lang/rust#58291

Current solution is to delete incremental compilation files for the particular project that reports the issues.

e.g on Linux when ra_batch fails to compile.

$ rm -rf ./target/debug/incremental/ra_batch-*

On Windows using cmd:

$ for /d %a in (.\target\debug\incremental\ra_batch-*) do rd /s /q %a

Simply change ra_batch-* to ra_ide_api-* when ra_ide_api fails to compile. This may occur in release as well, in that case change debug to release.

Example output of the error:

ra_ide_api
```
error[E0599]: no method named `parse` found for type `&db::RootDatabase` in the current scope
--> crates\ra_ide_api\src\call_info.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\call_info.rs:25:22
|
25 |     let fn_file = db.parse(symbol.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 2 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.
```
ra_batch
```
error[E0599]: no method named `set_crate_graph` found for type `BatchDatabase` in the current scope
--> crates\ra_batch\src\lib.rs:90:12
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_crate_graph` not found for this
...
90 |         db.set_crate_graph(Arc::new(crate_graph));
|            ^^^^^^^^^^^^^^^
|
= note: the method `set_crate_graph` exists but the following trait bounds were not satisfied:
        `BatchDatabase : 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 `set_crate_graph`, perhaps you need to implement it:
        candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `set_file_text` found for type `BatchDatabase` in the current scope
--> crates\ra_batch\src\lib.rs:110:32
    |
22  | pub struct BatchDatabase {
    | ------------------------ method `set_file_text` not found for this
...
110 |                             db.set_file_text(file_id, text);
    |                                ^^^^^^^^^^^^^
    |
    = note: the method `set_file_text` exists but the following trait bounds were not satisfied:
            `BatchDatabase : 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 `set_file_text`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `set_file_relative_path` found for type `BatchDatabase` in the current scope
--> crates\ra_batch\src\lib.rs:111:32
    |
22  | pub struct BatchDatabase {
    | ------------------------ method `set_file_relative_path` not found for this
...
111 |                             db.set_file_relative_path(file_id, path.clone());
    |                                ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the method `set_file_relative_path` exists but the following trait bounds were not satisfied:
            `BatchDatabase : 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 `set_file_relative_path`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `set_file_source_root` found for type `BatchDatabase` in the current scope
--> crates\ra_batch\src\lib.rs:112:32
    |
22  | pub struct BatchDatabase {
    | ------------------------ method `set_file_source_root` not found for this
...
112 |                             db.set_file_source_root(file_id, source_root_id);
    |                                ^^^^^^^^^^^^^^^^^^^^
    |
    = note: the method `set_file_source_root` exists but the following trait bounds were not satisfied:
            `BatchDatabase : 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 `set_file_source_root`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error[E0599]: no method named `set_source_root` found for type `BatchDatabase` in the current scope
--> crates\ra_batch\src\lib.rs:116:28
    |
22  | pub struct BatchDatabase {
    | ------------------------ method `set_source_root` not found for this
...
116 |                         db.set_source_root(source_root_id, Arc::new(source_root));
    |                            ^^^^^^^^^^^^^^^
    |
    = note: the method `set_source_root` exists but the following trait bounds were not satisfied:
            `BatchDatabase : 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 `set_source_root`, perhaps you need to implement it:
            candidate #1: `ra_db::SourceDatabase`

error: aborting due to 5 previous errors

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions