Commit Graph

100 Commits

Author SHA1 Message Date
Lukas Wirth
d154ea88f9 Split out proc-macros from the CrateGraph 2023-03-25 16:46:44 +01:00
bors
992a0fc074 Auto merge of #14403 - Veykril:dependencies, r=Veykril
internal: Bump Cargo.lock
2023-03-25 14:15:10 +00:00
Lukas Wirth
39e86e78c3 Bump Cargo.lock 2023-03-25 15:12:39 +01:00
Lukas Wirth
c01ba4a310 Reject symlinks in project-json 2023-03-25 14:22:05 +01:00
Lukas Wirth
d9c7d28e0d Report sysroot and rustc crate loading errors 2023-03-15 11:35:34 +01:00
Lukas Wirth
8b8cd04825 fix: Don't pass feature flags to rustc private crates metadata invocation 2023-03-15 10:52:50 +01:00
bors
6f297b9076 Auto merge of #14348 - Veykril:rustc-proc, r=Veykril
fix: Fix rustc proc-macro handling being broken on the rustc workspace itself

Also addresses https://github.com/rust-lang/rust-analyzer/issues/13591#issuecomment-1466966952
2023-03-14 10:34:23 +00:00
Lukas Wirth
88f0fe784f fix: Fix rustc proc-macro handling being broken on the rustc workspace itself 2023-03-14 11:33:40 +01:00
David Barsky
677c0eeccb Add path of workspace root folders to status output 2023-03-13 14:45:41 -04:00
Laurențiu Nicola
cfc9d5cd3b Pass flycheck extra args when running build scripts 2023-03-11 19:28:02 +02:00
Lukas Wirth
d8c80e7d95 Add core lib to proc_macro dependencies 2023-03-09 12:58:07 +01:00
Lukas Wirth
4ee2abaf38 minor: Fixup dylib extensions for rustc_private proc-macro loading 2023-03-08 14:45:47 +01:00
Lukas Wirth
c9786484c5 Load proc-macros for rustc_private crates 2023-03-08 12:41:38 +01:00
Lukas Wirth
88f2abb8f7 Don't drop rustc crates in the rustc workspace 2023-03-02 12:55:41 +01:00
Lukas Wirth
47a567b833 Deduplicate source roots that have overlapping include paths 2023-02-28 12:08:23 +01:00
bors
1d32a7b7c6 Auto merge of #14094 - HKalbasi:layout, r=flodiebold
Reuse fetching target data layout from rustc function

fix https://github.com/rust-lang/rust-analyzer/pull/14087?notification_referrer_id=NT_kwDOArGpCLM1NTEyMDQ5MjU3OjQ1MTk3NTc2#discussion_r1097850915
2023-02-06 22:35:37 +00:00
hkalbasi
40cf8b45ac reuse fetching target data layout from rustc function 2023-02-06 23:48:20 +03:30
Lukas Wirth
cb9a5b9549 Support sysroot library source being defined inside the workspace 2023-02-06 12:07:33 +01:00
Maybe Waffle
249ea9502d Set "current" edition to 2021 2023-01-31 10:51:43 +00:00
Lukas Wirth
b2598f4801 Don't fail workspace loading if sysroot can't be found 2023-01-27 13:49:28 +01:00
Lukas Wirth
1535881836 Replace SmolStr usage with lang item enum for lang items 2023-01-21 17:55:45 +01:00
Lukas Wirth
384fa4b84a fix: Fix target-data-layout fetching incorrectly passing 'rustc' to rustc 2023-01-19 21:31:08 +01:00
bors
fa874627f0 Auto merge of #13969 - Veykril:workspace.dependencies, r=Veykril
Use workspace.dependencies to declare local dependencies
2023-01-17 10:29:27 +00:00
Lukas Wirth
bed4db3c62 Use workspace.dependencies to declare local dependencies 2023-01-17 10:52:26 +01:00
Lukas Wirth
e4858fe480 Specify authors, edition and license via workspace.package 2023-01-16 16:44:00 +01:00
Lukas Wirth
679df2adf1 Specify rust-version via workspace.package 2023-01-16 16:33:01 +01:00
Alex Kladov
bd350085f6
Update crates/project-model/src/project_json.rs
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-01-13 12:01:04 +00:00
Alex Kladov
87315ef5c3
Apply suggestions from code review
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-01-13 11:57:02 +00:00
Aleksey Kladov
aa73366b0b internal: explain the idea behind rust-project.json 2023-01-13 11:44:02 +00:00
Daniel Eades
5b1cd8245f fixup 2023-01-10 19:44:19 +00:00
Daniel Eades
ac3844a0bb a number of code simplifications 2023-01-10 18:48:51 +00:00
Daniel Eades
4f8ffd0ba4 remove unnecessary lifetimes that can be elided 2023-01-02 15:02:54 +00:00
Daniel Eades
ed128872eb remove needless borrows 2023-01-02 14:52:32 +00:00
Daniel Eades
77051679d7 use inline format args 2023-01-02 14:52:32 +00:00
Yuri Astrakhan
e16c76e3c3 Inline all format arguments where possible
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.

The change was automatically created with, so there are far less change
of an accidental typo.

```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Yuri Astrakhan
e341e996f7 Clippy-fix explicit auto-deref
Seems like these can be safely fixed. With one, I was particularly
surprised -- `Some(pats) => &**pats,` in body.rs?

```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```
2022-12-23 02:52:14 -05:00
Lukas Wirth
a694c342fa Fix tests not using appropriate target data 2022-12-21 20:23:43 +01:00
Lukas Wirth
33591cd3f4 Calculate the TargetDataLayout correctly for the selected target 2022-12-21 15:11:24 +01:00
bors
81d26e730e Auto merge of #13667 - Veykril:detached-files-sysroot, r=Veykril
Handle sysroot config in detached-files workspaces
2022-11-24 09:21:44 +00:00
Lukas Wirth
2300c9de83 Handle sysroot config in detached-files workspaces 2022-11-24 10:21:19 +01:00
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
Lukas Wirth
52bc15fc1f fix: Fix proc-macro-srv search paths for Arch Linux 2022-11-18 23:32:26 +01:00
Alexis (Poliorcetics) Bourget
0d4737adb6 feat: Support passing multiple targets to cargo (for Rust 1.64.0+) 2022-11-11 14:36:07 +01:00
Lukas Wirth
3c35d44f55 Add proc-macro dependency to rustc_private crates 2022-11-09 20:50:18 +01:00
Lukas Wirth
ffd7bf8bf9 Bump Cargo rust-version fields to latest stable 2022-11-07 12:59:51 +01:00
Lukas Wirth
8ad4a1d118 Update sysroot crates 2022-11-07 12:01:12 +01:00
Lukas Wirth
859f5594ac Handle multiple projects sharing dependency correctly in once strategy 2022-10-23 18:01:35 +02:00
Lukas Wirth
0f8904ec9c Implement invocation location config 2022-10-22 23:33:03 +02:00
bors
a77ac93b2a Auto merge of #13128 - Veykril:invocation-strategy, r=Veykril
Implement invocation strategy config

Fixes https://github.com/rust-lang/rust-analyzer/issues/10793

This allows to change how we run build scripts (and `checkOnSave`), exposing two configs:
- `once`: run the specified command once in the project root (the working dir of the server)
- `per_workspace`: run the specified command per workspace in the corresponding workspace

This also applies to `checkOnSave` likewise, though `once_in_root` is useless there currently, due to https://github.com/rust-lang/cargo/issues/11007
2022-10-19 21:53:19 +00:00
Lukas Wirth
46732369f4 Remove simplistic interpolation for manifest-path 2022-10-19 23:53:00 +02:00