Commit graph

157 commits

Author SHA1 Message Date
Aleksey Kladov
afacdd612d internal: update expect 2021-10-09 17:17:16 +03:00
Jonas Schievink
0cd24c14c5 Only add proc_macro to prelude in proc-macro crates 2021-10-04 18:22:39 +02:00
Laurențiu Nicola
a683c08729 Remove support for old-style sysroot 2021-10-04 18:36:56 +03:00
Jonas Schievink
0e6922f8a8 Implicitly depend on test 2021-09-28 21:39:41 +02:00
Jonas Schievink
0b76b29512 support non-extern-prelude dependencies 2021-09-28 21:23:46 +02:00
Lukas Wirth
3987bf5d6f Simplify 2021-09-19 19:00:06 +02:00
Jonas Schievink
e241015a75 Rename is_member to is_local 2021-09-07 17:29:58 +02:00
Jonas Schievink
8a4c35a068 Treat path dependencies like workspace members 2021-09-07 17:26:21 +02:00
bors[bot]
1636f61a15
Merge #10005
10005: Extend `CargoConfig.unset_test_crates`  r=matklad a=regexident

This is to allow for efficiently disabling `#[cfg(test)]` on all crates (by passing `unset_test_crates: UnsetTestCrates::All`) without having to first load the crate graph, when using rust-analyzer as a library.

(FYI: The change doesn't seem to be covered by any existing tests.)

Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-08-30 08:42:13 +00:00
Dezhi Wu
ba0947dded switch log crate to tracing 2021-08-30 15:11:42 +08:00
Vincent Esche
74880a10ae Extend CargoConfig.unset_test_crates to allow for efficiently disabling #[cfg(test)] on all crates without having to first load the crate graph 2021-08-26 13:10:14 +02:00
Jonas Schievink
276f6c6ba4 Reduce visibility of WorkspaceBuildScripts::run 2021-08-25 18:02:27 +02:00
Jonas Schievink
0ff2c81bb9 Fix reporting of build script errors 2021-08-25 17:56:39 +02:00
Aleksey Kladov
4f8c6193d5 minor: remove dead code 2021-08-24 14:39:31 +03:00
Aleksey Kladov
881d71a489 internal: reduce crate interdependence
I don't think there's anything wrong with project_model depending on
proc_macro_api directly -- fundamentally, both are about gluing our pure
data model to the messy outside world.

However, it's easy enough to avoid the dependency, so why not.

As an additional consideration, `proc_macro_api` now pulls in `base_db`.
project_model should definitely not depend on that!
2021-08-22 13:32:00 +03:00
Aleksey Kladov
5cef007bff internal: improve consistency
load and load_proc_macro do similar things
2021-08-22 13:15:18 +03:00
Aleksey Kladov
4924c24d91 fix: resolve core::arch module
See https://users.rust-lang.org/t/rust-analyzer-unable-to-resolve-target-specific-module/63797/4?u=matklad

The fix is to put all sysroot crates into the same source root
2021-08-20 17:01:27 +03:00
Jonas Schievink
6f579c4862 Always add implicit proc_macro dependency 2021-08-12 21:42:14 +02:00
Toby Fleming
d0b98060d4
Rust project project model smoke tests 2021-08-01 15:00:34 -07:00
Toby Fleming
cb13e4a2ca
Rust project supports proc-macro dependent crates 2021-08-01 14:43:10 -07:00
Aleksey Kladov
b0c4b776b5 internal: add simple smoke test for project model
Our project model code is rather complicated -- the logic for lowering
from `cargo metadata` to `CrateGraph` is fiddly and special-case. So
far, we survived without testing this at all, but this increasingly
seems like a poor option.

So this PR introduces a simple tests just to detect the most obvious
failures. The idea here is that, although we rely on external processes
(cargo & rustc), we are actually using their stable interfaces, so we
might just mock out the outputs.

Long term, I would like to try to virtualize IO here, so as to do such
mocking in a more principled way, but lets start simple.

Should we forgo the mocking and just call `cargo metadata` directly
perhaps? Touch question -- I personally feel that fast, in-process tests
are more important in this case than any extra assurance we get from
running the real thing.

Super-long term, we would probably want to extend our heavy tests to
cover more use-cases, but we should figure a way to do that without
slowing the tests down for everyone.

Perhaps we need two-tiered bors system, where we pull from `master` into
`release` branch only when an additional set of tests passes?
2021-07-20 16:23:57 +03:00
Aleksey Kladov
52a70c392e minor: simplify 2021-07-19 21:21:41 +03:00
Aleksey Kladov
493ed2c17b internal: use types to remove some unwraps 2021-07-19 21:20:10 +03:00
Aleksey Kladov
b8b166e674 fix: potential bugs when build scripts do not match the current project 2021-07-18 13:13:03 +03:00
Aleksey Kladov
f4de2ece0d internal: simplify handling of the build scripts 2021-07-18 11:29:22 +03:00
Aleksey Kladov
8f3335f5fb internal: make it clearer where IO happens 2021-07-17 23:56:50 +03:00
Aleksey Kladov
8df38aa797 internal: make sure that proc macro machinery doesn't depend on cwd 2021-07-17 17:55:16 +03:00
Aleksey Kladov
9318c643f1 internal: make it easier to isolate IO 2021-07-17 17:55:16 +03:00
Jonas Schievink
7c2b9fb660 Set more CARGO_ env vars 2021-07-12 15:34:49 +02:00
kjeremy
35016c772c cargo_metadata 0.14
Removes the following dependent crates:
* semver-parser
* pest
* ucd-trie

Removes project_model's dependency on itertools
2021-07-09 11:01:55 -04:00
Aleksey Kladov
86720f2953 minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
Jonas Schievink
3fa07b31c9 Remove incorrect std dep 2021-07-02 15:42:42 +02:00
Jonas Schievink
be0f1d5ca6 sysroot: add proc_macro -> std dependency edge 2021-07-02 01:38:49 +02:00
Laurențiu Nicola
cc54d2bbc6 Avoid redundant clone 2021-06-28 09:28:31 +03:00
Aleksey Kladov
93e3659194 intenral: small improvements to compile time
AsRef-polymorphism has compile-time cost.
2021-06-25 23:51:54 +03:00
rezural
f55b1d1e19 add extra include paths, if target's path is manually set in Cargo.toml to be 2021-06-22 08:59:57 +10:00
Jamie Cunliffe
ae823aa23f Move features into potential_cfg_options 2021-06-21 17:54:05 +01:00
Jamie Cunliffe
284483b347 Improve completion of cfg attributes
The completion of cfg will look at the enabled cfg keys when
performing completion.

It will also look crate features when completing a feature cfg
option. A fixed list of known values for some cfg options are
provided.

For unknown keys it will look at the enabled values for that cfg key,
which means that completion will only show enabled options for those.
2021-06-21 17:47:00 +01:00
bors[bot]
b48aba0090
Merge #9227
9227: Add a config setting to disable the 'test' cfg in specified crates r=matklad a=lf-

If you are opening libcore from rust-lang/rust as opposed to e.g.
goto definition from some other crate which would use the sysroot
instance of libcore, a `#![cfg(not(test))]` would previously have made
all the code excluded from the module tree, breaking the editor
experience.

Core does not need to ever be edited with `#[cfg(test)]` enabled,
as the tests are in another crate.

This PR puts in a slight hack that checks for the crate name "core" and
turns off `#[cfg(test)]` for that crate.

Fixes #9203 
Fixes #9226 

Co-authored-by: Jade <software@lfcode.ca>
2021-06-21 13:41:27 +00:00
Jonas Schievink
9e306909db Update sysroot crates 2021-06-21 15:26:26 +02:00
Jade
8b77e2692c Implement a config override for the default #[cfg(test)] in cargo crates
Fixes crates which vanish when the 'test' cfg atom is set.

Fix #7243.
Fix #9203.
Fix #7225.
2021-06-19 01:09:19 -07:00
Jade
1f6abb7fba Fix libcore not being included in rust-lang/rust module tree
If you are opening libcore from rust-lang/rust as opposed to e.g.
goto definition from some other crate which would use the sysroot
instance of libcore, a `#![cfg(not(test))]` would previously have made
all the code excluded from the module tree, breaking the editor
experience.

This puts in a slight hack that checks for the crate name "core" and
turns off `#[cfg(test)]`.
2021-06-19 01:09:19 -07:00
Laurențiu Nicola
6b1f0057f2 Avoid string allocation 2021-06-18 14:46:18 +03:00
Laurențiu Nicola
e3ce88f6f2 Minor clippy perf fixes 2021-06-18 14:40:51 +03:00
Maan2003
c9b4ac5be4
clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
Laurențiu Nicola
8206939fed clippy::redundant_clone fixes 2021-05-26 18:34:50 +03:00
Jonas Schievink
518d39cd2f Duplicate dependencies that have multiple DepKinds 2021-05-24 18:31:43 +02:00
Kirill Bulatov
5c0369b1d0 Add a FIXME 2021-05-24 14:52:57 +03:00
Kirill Bulatov
d8c36029cc
Small file error display fix
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-24 14:47:20 +03:00
Kirill Bulatov
72594beca4 Deal with todos 2021-05-23 23:37:59 +03:00