aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model
Commit message (Collapse)AuthorAgeFilesLines
* internal: do not drop errors from cargo metadata/checkAleksey Kladov2021-04-061-1/+1
| | | | Work towards #3155
* clippy::complexity simplifications related to IteratorsMatthias Krüger2021-03-211-49/+42
|
* some clippy::performance fixesMatthias Krüger2021-03-151-1/+1
| | | | | | | use vec![] instead of Vec::new() + push() avoid redundant clones use chars instead of &str for single char patterns in ends_with() and starts_with() allocate some Vecs with capacity to avoid unneccessary resizing
* Never run cargo check on the rustc sourceDaniel McNab2021-03-081-4/+1
|
* Only show directory nameDaniel McNab2021-03-081-1/+1
|
* Revert "Support disabling rustc build scripts"Daniel McNab2021-03-081-10/+3
| | | | This reverts commit ddce6bb282764692d53b719bff4c37e3512d4556.
* Support disabling rustc build scriptsDaniel McNab2021-03-081-3/+11
|
* Fix the commentDaniel McNab2021-03-071-4/+4
| | | | It's worse than I thought...
* Extract the large nested block into a functionDaniel McNab2021-03-071-72/+98
| | | | | Also add some more detailed comments Extract into function deleted the previous comments
* Require opt in to rustc_privateDaniel McNab2021-03-072-70/+70
| | | | | | This gives the advantage that A future extension would be to check for `feature(rustc_private)` instead
* Don't double analyse the same crateDaniel McNab2021-03-071-1/+6
|
* Update crate graph to only use subcrates of rustc_driverDaniel McNab2021-03-071-38/+38
|
* If a manual dependency exists, don't overwriteDaniel McNab2021-03-061-1/+8
| | | | | | | | This is a hack to work around miri being included in our analysis of rustc-dev Really, we should probably use an include set of the actual root libraries I'm not sure how those are determined however
* Implement opt-in (and opt-out) rustc_privateDaniel McNab2021-03-062-3/+26
|
* Bump cargo_metadataLaurențiu Nicola2021-03-023-21/+21
|
* Fix a few clippy::perf warningskjeremy2021-02-161-1/+1
|
* Allow automatically detect the rustc-src directory (fixes #3517).Benjamin Bouvier2021-02-134-14/+54
| | | | | If the configured rustcSource is set to "discover", try to automatically detect a source from the sysroot rustc directory.
* Async Loading outdir and proc-macroEdwin Cheng2021-01-284-154/+235
|
* Make logger-based debugging more pleasantAleksey Kladov2021-01-281-2/+3
|
* Export `CARGO` for proc. macrosJonas Schievink2021-01-271-1/+4
|
* Use AbsPathEdwin Cheng2021-01-221-3/+3
|
* Refactor build script dataEdwin Cheng2021-01-224-196/+228
|
* Added defined_features in PackageDataEdwin Cheng2021-01-212-5/+8
|
* Avoid blocking the main loop when editing Cargo.tomlAleksey Kladov2021-01-183-61/+93
| | | | | | | | | | I've noticed a bunch of "main loop too long" warnings in console when typing in Cargo.toml. Profiling showed that the culprit is `rustc --print cfg` call. I moved it to the background project loading phase, where it belongs. This highlighted a problem: we generally use single `cfg`, while it really should be per crate.
* Add profile callAleksey Kladov2021-01-181-0/+1
|
* Add profile callAleksey Kladov2021-01-182-0/+4
|
* :arrow_up: arenaAleksey Kladov2021-01-171-1/+1
|
* Depend on local copy of la-arena instead of crates.io’sAramis Razzaghipour2021-01-171-1/+1
|
* prepare to publish el libro de arenaAleksey Kladov2021-01-143-3/+3
|
* Use --workspace when loading extern resourcesChinedu Francis Nwafili2021-01-141-1/+1
| | | https://github.com/rust-analyzer/rust-analyzer/issues/5040#issuecomment-759853153
* Unfreeze cargo_metadatakjeremy2021-01-111-1/+1
| | | | It now pulls in a newer version of semver-parser.
* Report progress for cargo metadata and output-dirEdwin Cheng2021-01-072-14/+34
|
* Document `project_model::TargetData`Arnaud2021-01-061-0/+6
| | | | This adds a description for `TargetData` and all its fields.
* Document `project_model::PackageData`Arnaud2021-01-061-0/+16
| | | | This adds a description for `PackageData` and all its fields.
* Make `PackageData`, `TargetData` and `PackageDependency` publicArnaud2021-01-061-2/+5
| | | | | This makes them discoverable through documentation. They were already publicly accessible through `Package` and `Target`.
* More maintainable configAleksey Kladov2021-01-061-5/+5
| | | | | | | Rather than eagerly converting JSON, we losslessly keep it as is, and change the shape of user-submitted data at the last moment. This also allows us to remove a bunch of wrong Defaults
* Add support for Rust 2021.Mara Bos2021-01-011-0/+3
|
* Merge #7071bors[bot]2020-12-311-0/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7071: Pass --all-targets to "cargo check" when discovering external resources r=matklad a=WasabiFan There is a repro case and background in the linked issue. In short, the goal of this MR is to allow rust-analyzer to discover proc-macros which come from your tests (including, most importantly, dev-dependencies). By default, `cargo check` implies the equivalent of `--lib --bins`, meaning it'll check your libraries and binaries -- but not tests! This means proc-macros (or, I guess, build scripts as well) weren't discovered by rust-analyzer if they came from tests. One solution would be to manually add `--lib --bins --tests` (i.e., just augment the effective options to include tests). However, in this MR, I threw in `--all-targets`, which [according to the docs](https://doc.rust-lang.org/cargo/commands/cargo-check.html#target-selection) implies `--benches --examples` too. I have absolutely no idea what repercussions that will have on rust-analyzer for other projects, nor do I know if it's a problem that build scripts will now be discovered for tests/examples/benches. But I am not aware of a reason you _wouldn't_ want to discover these things in your examples too. I think the main drawback of this change is that it will likely slow down the `cargo check`. At a minimum, it'll now be checking your tests _and_ their dependencies. The `cargo check` docs also say that including `--tests` as I have here may cause your lib crate to be built _twice_, once for the normal target and again for unit tests. My reading of that caveat suggests that "building twice" means it's built once for the tests _inside_ your lib, with a test profile, and again for any consumers of your lib, now using a normal release profile or similar. This doesn't seem surprising. Very minor caveat: `--tests` will not include tests within a binary if it has `test = false` set in `Cargo.toml`. (I discovered this manually by trial-and-error, but hey, it actually says that in the docs!) This is likely not an issue, but _does_ mean that if you are -- for whatever reason -- disabling tests like that and then manually specifying `cargo test --package <...> --bin <...>` to run them, rust-analyzer will remain unaware of proc-macros in your tests. I have confirmed this fixes the original issue in my sandbox example linked in #7034 and in my own project in which I originally discovered this. I've left it configured as my default RA language server and will report back if I notice any unexpected side-effects. Fixes #7034 Co-authored-by: Kaelin Laundry <[email protected]>
| * Pass --all-targets to "cargo check"Kaelin Laundry2020-12-291-0/+5
| |
* | add working dir to cargo metadata fail messageslf-2020-12-311-1/+17
| |
* | Update crateskjeremy2020-12-301-1/+1
|/
* Fun times with rustfmtJon Gjengset2020-12-171-2/+1
|
* Update crates/project_model/src/cargo_workspace.rsJon Gjengset2020-12-171-1/+1
| | | Co-authored-by: Aleksey Kladov <[email protected]>
* Default to host platform for cargo metadataJon Gjengset2020-12-171-2/+30
| | | | | | | | | This modifies the logic for calling cargo metadata so that it will use the host platform if no explicit target platform is given. This is needed since cargo metadata defaults to outputting information for _all_ targets. Fixes #6908.
* Change recommendation when source can't be loaded from sysrootFlorian Diebold2020-12-131-1/+1
| | | | | | | | | Since we just tried running `rustup component add`, it doesn't make sense to me to recommend trying that again. If we're reaching this case, it's probably more likely that rustc was installed via package manager, in which case the source should be installed the same way (e.g. if you install the rust-src package on Ubuntu it will install a symlink in the right place to make our sysroot detection work).
* Remove some redundant allocationsJeremy Kolb2020-12-121-1/+1
|
* Use itertoolsJonas Schievink2020-12-102-3/+4
|
* Replicate Cargo environment variablesJonas Schievink2020-12-101-0/+39
|
* Apply environment set by build scriptsJonas Schievink2020-12-072-2/+20
|
* Pass `--target` when loading out dirs from checkJonas Schievink2020-12-071-0/+5
|