rust/crates/rust-analyzer/src
bors 38fa47fd79 Auto merge of #13290 - poliorcetics:multiple-targets, r=Veykril
Support multiple targets for checkOnSave (in conjunction with cargo 1.64.0+)

This PR adds support for the ability to pass multiple `--target` flags when using
`cargo` 1.64.0+.

## Questions

I needed to change the type of two configurations options, but I did not plurialize the names to
avoid too much churn, should I ?

## Zulip thread

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Issue.2013282.20.28supporting.20multiple.20targets.20with.201.2E64.2B.29

## Example

To see it working, on a macOS machine:

```sh
$ cd /tmp
$ cargo new cargo-multiple-targets-support-ra-test
$ cd !$
$ mkdir .cargo
$ echo '
[build]
target = [
    "aarch64-apple-darwin",
    "x86_64-apple-darwin",
]
' > .cargo/config.toml
$ echo '
fn main() {
    #[cfg(all(target_arch = "aarch64", target_os = "macos"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }

    #[cfg(all(target_arch = "x86_64", target_os = "macos"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }

    #[cfg(all(target_arch = "x86_64", target_os = "windows"))]
    {
        let a = std::fs::read_to_string("/tmp/test-read");
    }
}
' > src/main.rs
# launch your favorite editor with the version of RA from this PR
#
# You should see warnings under the first two `let a = ...` but not the third
```

## Screen

![Two panes of a terminal emulator, on the left pane is the main.rs file described above, with warnings for the first two let a = declaration, on the right pane is a display of the .cargo/config.toml, an ls of the current files in the directory and a call to cargo build to show the same warnings as in the editor on the left pane](https://user-images.githubusercontent.com/7951708/192122707-7a00606a-e581-4534-b9d5-b81c92694e8e.png)

Helps with #13282
2022-11-19 13:09:37 +00:00
..
bin Switch to upstream positionEncoding 2022-10-25 14:43:26 +03:00
cli Auto merge of #13639 - Veykril:macro-diags, r=Veykril 2022-11-19 09:33:10 +00:00
config
diagnostics Fix tests checking the data value 2022-11-18 20:15:49 +01:00
caps.rs Switch to upstream positionEncoding 2022-10-25 14:43:26 +03:00
cargo_target_spec.rs internal: Use Cancellable in favor of Result for clarity 2022-11-07 17:21:37 +01:00
cli.rs feat: emit SCIP via rust-analyzer 2022-08-22 15:13:46 -04:00
config.rs feat: Support passing multiple targets to cargo (for Rust 1.64.0+) 2022-11-11 14:36:07 +01:00
diagnostics.rs Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
diff.rs
dispatch.rs fix: Fix formatting requests hanging when r-a is still starting 2022-10-17 18:21:18 +02:00
from_proto.rs internal: error instead of panic on invalid file range 2022-11-07 17:45:12 +01:00
global_state.rs fix: Fix r-a eagerly showing no discovered workspace errors 2022-11-11 14:36:27 +01:00
handlers.rs internal: Use Cancellable in favor of Result for clarity 2022-11-07 17:21:37 +01:00
integrated_benchmarks.rs Restructure find_path into a separate functions for modules and non-module items 2022-09-13 15:15:27 +02:00
lib.rs
line_index.rs Fix typos 2022-11-07 12:54:12 +02:00
lsp_ext.rs Switch to upstream positionEncoding 2022-10-25 14:43:26 +03:00
lsp_utils.rs internal: Optimize apply_document_changes a bit 2022-11-05 10:59:46 +01:00
main_loop.rs fix: Fix r-a eagerly showing no discovered workspace errors 2022-11-11 14:36:27 +01:00
markdown.rs
mem_docs.rs internal: Use Cancellable in favor of Result for clarity 2022-11-07 17:21:37 +01:00
op_queue.rs
reload.rs fix: Fix proc-macro-srv search paths for Arch Linux 2022-11-18 23:32:26 +01:00
semantic_tokens.rs Re-export standard semantic token types and mods 2022-08-23 18:06:32 +02:00
task_pool.rs
to_proto.rs Auto merge of #13572 - Veykril:cancellable, r=Veykril 2022-11-07 16:22:33 +00:00
version.rs