Mario Carneiro
2d349aed2e
Update crates/hir_expand/src/db.rs
...
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-08-30 02:43:13 -07:00
Mario Carneiro
6e8dedadcd
Fix error message
...
I'm not entirely sure if the message is still correct, it seems to have survived a number of refactors, but it is mangled english anyway.
2021-08-30 02:36:21 -07: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
bors[bot]
d250aa77ec
Merge #10015
...
10015: internal: more declarative re-indentation API r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-30 08:34:49 +00:00
bors[bot]
ceecf853ee
Merge #10080
...
10080: internal: don't shut up the compiler when it says the code's buggy r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-30 07:58:59 +00:00
Aleksey Kladov
a833fba98a
internal: don't shut up the compiler when it says the code's buggy
...
Wrapping state-modifying functions into a `catch_unwind` is wrong -- to
do retry after failure, you need to have transactional semantics!
2021-08-30 10:58:39 +03:00
bors[bot]
b3452dd379
Merge #10079
...
10079: internal: make upstream bug less annoying r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-30 07:39:34 +00:00
Aleksey Kladov
3a055a6b1f
internal: make upstream bug less annoying
2021-08-30 10:32:59 +03:00
bors[bot]
43ed5368d2
Merge #9906
...
9906: switch `log` crate to `tracing` r=lnicola a=dzvon
Fixes #9274
1. Replace `log` crate with `tracing` of every crate that depend on `log`.
2. Change all `log` record macro with `tracing`.
3. Add `LoggerFormatter` make output format be the same as original.
Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-08-30 07:30:01 +00:00
Dezhi Wu
ba0947dded
switch log
crate to tracing
2021-08-30 15:11:42 +08:00
bors[bot]
c41870076b
Merge #10078
...
10078: internal: Use Ubuntu 18.04 on CI r=lnicola a=lnicola
Ubuntu 16.04 is EOL since April, let's upgrade to 18.04.
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-08-30 06:54:36 +00:00
Laurențiu Nicola
878dd9d3ad
Use Ubuntu 18.04 on CI
2021-08-30 09:50:41 +03:00
bors[bot]
d15f646ff1
Merge #10074
...
10074: internal: improve compile times a bit r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-29 15:56:06 +00:00
Aleksey Kladov
cfa3f679e9
internal: don't expose impl details out of hir
2021-08-29 18:55:25 +03:00
Aleksey Kladov
76b60efbfb
internal: improve compile times a bit
...
before after for cargo llvm-lines -q --lib --release -p ide_ssr | head -n 24
Lines Copies Function name
----- ------ -------------
297146 (100%) 12748 (100%) (TOTAL)
5970 (2.0%) 47 (0.4%) core::iter::traits::iterator::Iterator::try_fold
4750 (1.6%) 27 (0.2%) hashbrown::raw::RawTable<T,A>::resize
4080 (1.4%) 30 (0.2%) alloc::raw_vec::RawVec<T,A>::grow_amortized
3933 (1.3%) 69 (0.5%) alloc::raw_vec::RawVec<T,A>::current_memory
3668 (1.2%) 89 (0.7%) <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
3500 (1.2%) 50 (0.4%) hashbrown::raw::RawTable<T,A>::drop_elements
3436 (1.2%) 33 (0.3%) hashbrown::raw::RawTable<T,A>::find
3415 (1.1%) 17 (0.1%) hashbrown::raw::RawTable<T,A>::rehash_in_place
3400 (1.1%) 50 (0.4%) <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
2840 (1.0%) 20 (0.2%) alloc::raw_vec::RawVec<T,A>::allocate_in
2700 (0.9%) 30 (0.2%) core::alloc::layout::Layout::array
2666 (0.9%) 86 (0.7%) core::ptr::metadata::from_raw_parts_mut
2495 (0.8%) 50 (0.4%) core::option::Option<T>::map
2354 (0.8%) 38 (0.3%) alloc::alloc::box_free
2302 (0.8%) 7 (0.1%) ide_ssr::parsing::RuleBuilder::try_add
2146 (0.7%) 45 (0.4%) core::mem::replace
2070 (0.7%) 69 (0.5%) <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
1979 (0.7%) 16 (0.1%) hashbrown::map::HashMap<K,V,S,A>::insert
1926 (0.6%) 18 (0.1%) <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
1922 (0.6%) 62 (0.5%) core::fmt::ArgumentV1::new
1885 (0.6%) 13 (0.1%) alloc::raw_vec::RawVec<T,A>::shrink
Lines Copies Function name
----- ------ -------------
261717 (100%) 11666 (100%) (TOTAL)
5239 (2.0%) 42 (0.4%) core::iter::traits::iterator::Iterator::try_fold
4750 (1.8%) 27 (0.2%) hashbrown::raw::RawTable<T,A>::resize
3933 (1.5%) 69 (0.6%) alloc::raw_vec::RawVec<T,A>::current_memory
3536 (1.4%) 26 (0.2%) alloc::raw_vec::RawVec<T,A>::grow_amortized
3500 (1.3%) 50 (0.4%) hashbrown::raw::RawTable<T,A>::drop_elements
3400 (1.3%) 50 (0.4%) <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
3124 (1.2%) 30 (0.3%) hashbrown::raw::RawTable<T,A>::find
2812 (1.1%) 14 (0.1%) hashbrown::raw::RawTable<T,A>::rehash_in_place
2604 (1.0%) 84 (0.7%) core::ptr::metadata::from_raw_parts_mut
2340 (0.9%) 26 (0.2%) core::alloc::layout::Layout::array
2302 (0.9%) 7 (0.1%) ide_ssr::parsing::RuleBuilder::try_add
2272 (0.9%) 16 (0.1%) alloc::raw_vec::RawVec<T,A>::allocate_in
2201 (0.8%) 35 (0.3%) alloc::alloc::box_free
2104 (0.8%) 44 (0.4%) core::mem::replace
2079 (0.8%) 42 (0.4%) <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
2070 (0.8%) 69 (0.6%) <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
1926 (0.7%) 18 (0.2%) <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
1885 (0.7%) 13 (0.1%) alloc::raw_vec::RawVec<T,A>::shrink
1833 (0.7%) 13 (0.1%) hashbrown::raw::RawTable<T,A>::shrink_to
1771 (0.7%) 91 (0.8%) core::ptr::read
1701 (0.6%) 35 (0.3%) core::option::Option<T>::map
2021-08-29 18:49:16 +03:00
bors[bot]
35d98070d2
Merge #10071
...
10071: internal: slightly improve compile times r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-29 09:54:33 +00:00
Aleksey Kladov
78365c64c8
internal: slightly improve compile times
...
As per style guide, avoid monomorphisations
2021-08-29 12:53:56 +03:00
Aleksey Kladov
bef5e3096e
minor: remove debug print
2021-08-29 12:33:07 +03:00
bors[bot]
7c7a41c5e9
Merge #10067
...
10067: Downmap tokens to all token descendants instead of just the first r=Veykril a=Veykril
With this we can now resolve usages of identifiers inside (proc-)macros even if they are used for different purposes multiple times inside the expansion.
Example here being with the cursor being on the `no_send_sync_value` function causing us to still highlight the identifier in the attribute invocation correctly as we now resolve its usages in there. Prior we only saw the first usage of the identifier which is for a definition only, as such we bailed and didn't highlight it.
![image](https://user-images.githubusercontent.com/3757771/131233056-7e645b1d-b82f-468c-bf19-d3335a2cf7c2.png )
Note that this has to be explicitly switched over for most IDE features now as pretty much everything expects a single node/token as a result from descending.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-28 23:38:34 +00:00
Lukas Wirth
6993a607cb
Simplify
2021-08-29 01:38:10 +02:00
Lukas Wirth
99f1e66997
Only report unique text ranges in highlight_related
2021-08-29 01:11:29 +02:00
Lukas Wirth
72bfbb0691
Return all usages inside macros in usage searches
2021-08-29 00:49:57 +02:00
Lukas Wirth
512135920d
Highlight all related tokens in macro inputs
2021-08-29 00:49:57 +02:00
Lukas Wirth
c5059e0623
Return all ranges corresponding to a token id in TokenMap
2021-08-29 00:49:57 +02:00
bors[bot]
7e31c5ec0d
Merge #10069
...
10069: internal: Use `ManuallyDrop` in `RootDatabase` to improve build times r=matklad a=jonas-schievink
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-08-28 21:13:18 +00:00
Jonas Schievink
002ef7d50a
Use ManuallyDrop
in RootDatabase
2021-08-28 23:05:40 +02:00
bors[bot]
10e9408d38
Merge #10066
...
10066: internal: improve compile times a bit r=matklad a=matklad
I wanted to *quickly* remove `smol_str = {features = "serde"}`, and figured out that the simplest way to do that is to replace our straightforward proc macro serialization with something significantly more obscure.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-28 20:38:58 +00:00
Aleksey Kladov
0d5c671d76
minor: reformat
2021-08-28 23:38:39 +03:00
Aleksey Kladov
c639fe333f
internal: improve compilation critical path a bit
2021-08-28 22:43:37 +03:00
Aleksey Kladov
0dabcf0044
remove unused serde feature from smol_str
2021-08-28 22:43:37 +03:00
Aleksey Kladov
55e9476e4b
internal: more production-ready proc-macro RPC deserialization
...
* avoid arbitrary nested JSON tree (danger of stack overflow)
* use more compact representation.
2021-08-28 22:43:37 +03:00
bors[bot]
2e3322d3f5
Merge #10062
...
10062: Set esbuild target as node14 r=matklad a=mtsmfm
ref: https://github.com/rust-analyzer/rust-analyzer/pull/10061
Currently, target version is not specified so it's esnext.
https://esbuild.github.io/api/#target
VSCode uses node 14 since version 1.56.
https://github.com/rust-analyzer/rust-analyzer/issues/3167#issuecomment-907058367
Co-authored-by: Fumiaki MATSUSHIMA <mtsmfm@gmail.com>
2021-08-28 14:48:46 +00:00
Fumiaki MATSUSHIMA
7bbca5d6f3
Set esbuild target as node14
2021-08-28 14:43:44 +00:00
bors[bot]
fae440c32a
Merge #10025
...
10025: Don't mutate syntax trees when preparing proc-macro input r=Veykril a=Veykril
Fixes #10013
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-28 14:14:54 +00:00
bors[bot]
9ea3c4d53b
Merge #10059
...
10059: feat: Enable diagnostics in `const` and `static` items r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-08-27 21:22:35 +00:00
Jonas Schievink
3047ae8d0f
Enable diagnostics in const
and static
items
2021-08-27 23:21:21 +02:00
bors[bot]
99e67f8998
Merge #10044
...
10044: minor: Ignore text and bench attributes again r=Veykril a=Veykril
Reverts part of #9943
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 20:19:56 +00:00
Lukas Wirth
798c53925a
Ignore text and bench attributes again
2021-08-27 22:19:04 +02:00
bors[bot]
97409e5fc8
Merge #9970
...
9970: feat: Implement attribute input token mapping, fix attribute item token mapping r=Veykril a=Veykril
![image](https://user-images.githubusercontent.com/3757771/130328577-4c1ad72c-51b1-47c3-8d3d-3242ec44a355.png )
The token mapping for items with attributes got overwritten partially by the attributes non-item input, since attributes have two different inputs, the item and the direct input both.
This PR gives attributes a second TokenMap for its direct input. We now shift all normal input IDs by the item input maximum(we maybe wanna swap this see below) similar to what we do for macro-rules/def. For mapping down we then have to figure out whether we are inside the direct attribute input or its item input to pick the appropriate mapping which can be done with some token range comparisons.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9867
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 19:30:36 +00:00
bors[bot]
3acbf94d29
Merge #10057
...
10057: fix: Remove incorrect assertion in extract_function r=Veykril a=Veykril
This assertion is actually just wrong
Fixes #10056
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 18:00:37 +00:00
Lukas Wirth
5c3a93ca9e
Remove incorrect assertion in extract_function
2021-08-27 19:58:57 +02:00
bors[bot]
12a36db71c
Merge #10055
...
10055: fix: Don't use fake text range in original node search as is in completions r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10042
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 13:11:34 +00:00
Lukas Wirth
ebb87fe157
Don't use fake text range in original node search as is in completions
2021-08-27 15:10:42 +02:00
bors[bot]
ef54dace6a
Merge #10054
...
10054: minor: Ignore text and bench attributes again r=Veykril a=Veykril
cc https://github.com/rust-analyzer/rust-analyzer/issues/8518#issuecomment-907039593
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-27 12:21:46 +00:00
Lukas Wirth
5012fa2dd4
Add completion tests for cursor after items
2021-08-27 14:21:17 +02:00
bors[bot]
4ad0a1b8a5
Merge #10053
...
10053: Remove old workaround in vscode extension r=lnicola a=Azorlogh
See #3167 .
Co-authored-by: = <bott.alix@gmail.com>
2021-08-27 09:46:25 +00:00
=
e3dd43ceba
remove workaround from old node versions
2021-08-27 11:31:25 +02:00
bors[bot]
8f683e911c
Merge #10049
...
10049: minor: nicer way to defeat disjoint closure captures r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-26 19:14:09 +00:00
Aleksey Kladov
cb3d04c818
minor: nicer way to defeat disjoint closure captures
...
Thanks https://internals.rust-lang.org/t/feature-idea-edition-dependent-names-replacing-standard-library-items/15198/27?u=matklad !
2021-08-26 22:13:50 +03: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