about summary refs log tree commit diff
path: root/crates/cfg/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2022-03-21Replace write! with direct callsLaurențiu Nicola-4/+4
2021-11-05Replace some String usages with SmolStr in completionsLukas Wirth-16/+13
2021-10-14a few clippy fixesMilo-0/+4
2021-07-20internal: add simple smoke test for project modelAleksey Kladov-1/+16
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-06-21Improve completion of cfg attributesJamie Cunliffe-0/+20
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-19Implement a config override for the default #[cfg(test)] in cargo cratesJade-0/+1
Fixes crates which vanish when the 'test' cfg atom is set. Fix #7243. Fix #9203. Fix #7225.
2021-06-19Fix libcore not being included in rust-lang/rust module treeJade-1/+15
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-13tree-wide: make rustdoc links spiky so they are clickableJade-1/+1
2021-05-07internal: expose cfg attrs from hir::CrateAleksey Kladov-1/+1
2020-11-17Remove dead codeAleksey Kladov-6/+0
2020-10-23cfg: move tests to separate fileJonas Schievink-0/+2
that way we don't have to re-check the entire project when a test is changed
2020-10-22Fix typoJonas Schievink-1/+1
2020-10-22Implement DNF-based `#[cfg]` introspectionJonas Schievink-0/+110
2020-10-21Simplify cfg representationJonas Schievink-15/+7
2020-08-13Rename ra_cfg -> cfgAleksey Kladov-0/+51