Laurențiu Nicola
a2aee95ce3
Merge remote-tracking branch 'upstream/master' into sync-from-rust
2024-01-16 08:48:23 +02:00
Laurențiu Nicola
ff7151362b
Merge branch 'master' into sync-from-rust
2024-01-16 08:48:08 +02:00
Moritz Hedtke
fe35447617
fix: rename generator to coroutine also in dependencies
...
Follow the rename in nightly (see https://blog.rust-lang.org/inside-rust/2023/10/23/coroutines.html )
2024-01-15 12:24:48 +01:00
Moritz Hedtke
f937673ce2
fix: rename generator to coroutine
...
Follow the rename in nightly (see https://blog.rust-lang.org/inside-rust/2023/10/23/coroutines.html )
2024-01-15 12:24:47 +01:00
Moritz Hedtke
a356172f92
internal: re-generate lints.rs
2024-01-15 12:24:47 +01:00
Lukas Wirth
180e9b2bbf
Cleanup
2024-01-15 12:22:51 +01:00
Lukas Wirth
1669344b2a
Thinner DefDiagnostics
2024-01-15 11:07:26 +01:00
Lukas Wirth
2d72ec71ec
Deduplicate
2024-01-15 10:58:05 +01:00
Laurențiu Nicola
6bbd106c70
Merge commit '9d8889cdfcc3aa0302353fc988ed21ff9bc9925c' into sync-from-ra
2024-01-15 11:40:09 +02:00
Lukas Wirth
d80d2fcae0
Eagerly lower enum variants in CrateDefMap construction
2024-01-15 10:24:14 +01:00
bors
a616c4d117
Auto merge of #16356 - Veykril:sysroot-metadata, r=Veykril
...
internal: Add unstable config for loading the sysroot sources via `cargo metadata`
cc https://github.com/rust-lang/rust-analyzer/issues/7637
This takes the approach of having `cargo metadata` generate a lock file that we then delete again, hence why this is behind a flag. If people need this for their workflow they can just enable it, if not, they are probably better off keeping it disabled. [example](https://dreampuf.github.io/GraphvizOnline/#digraph%20rust_analyzer_crate_graph%20%7B%0A%20%20%20%20_0%5Blabel%3D%22core%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_17%5Blabel%3D%22ra_playground%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_14%5Blabel%3D%22getopts%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_11%5Blabel%3D%22std_detect%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_8%5Blabel%3D%22unwind%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_5%5Blabel%3D%22hashbrown%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_2%5Blabel%3D%22alloc%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_16%5Blabel%3D%22test%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_13%5Blabel%3D%22unicode_width%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_10%5Blabel%3D%22rustc_demangle%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_7%5Blabel%3D%22panic_abort%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_4%5Blabel%3D%22cfg_if%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_1%5Blabel%3D%22compiler_builtins%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_18%5Blabel%3D%22build_script_build%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_15%5Blabel%3D%22proc_macro%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_12%5Blabel%3D%22std%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_9%5Blabel%3D%22panic_unwind%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_6%5Blabel%3D%22libc%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_3%5Blabel%3D%22allocator_api2%22%5D%5Bshape%3D%22box%22%5D%3B%0A%20%20%20%20_17%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_17%20-%3E%20_2%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_17%20-%3E%20_12%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_17%20-%3E%20_15%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_17%20-%3E%20_16%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_14%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_14%20-%3E%20_12%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_14%20-%3E%20_13%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_11%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_11%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_11%20-%3E%20_2%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_11%20-%3E%20_4%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_11%20-%3E%20_6%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_8%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_8%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_8%20-%3E%20_4%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_8%20-%3E%20_6%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_5%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_5%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_5%20-%3E%20_2%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_5%20-%3E%20_3%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_2%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_2%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_16%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_16%20-%3E%20_7%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_16%20-%3E%20_9%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_16%20-%3E%20_12%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_16%20-%3E%20_14%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_13%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_13%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_13%20-%3E%20_12%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_10%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_10%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_7%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_7%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_7%20-%3E%20_2%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_7%20-%3E%20_4%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_7%20-%3E%20_6%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_1%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_18%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_18%20-%3E%20_2%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_18%20-%3E%20_12%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_18%20-%3E%20_15%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_18%20-%3E%20_16%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_15%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_15%20-%3E%20_12%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_2%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_4%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_4%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_5%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_6%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_7%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_8%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_9%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_10%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_12%20-%3E%20_11%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_9%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_9%20-%3E%20_1%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_9%20-%3E%20_2%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_9%20-%3E%20_4%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_9%20-%3E%20_6%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_9%20-%3E%20_8%5Blabel%3D%22%22%5D%3B%0A%20%20%20%20_6%20-%3E%20_0%5Blabel%3D%22%22%5D%3B%0A%7D%0A )
![image](https://github.com/rust-lang/rust-analyzer/assets/3757771/7709bb38-d948-4106-82c2-9b76677620bd )
hashbrown resolves as a dependency now
2024-01-15 09:12:10 +00:00
Lukas Wirth
c7eb52dd7b
internal: Add unstable config for loading the sysroot sources via cargo metadata
2024-01-15 09:59:32 +01:00
bors
0b19e48eb8
Auto merge of #16361 - dtolnay-contrib:visualstudio, r=Veykril
...
Add a stable #visual-studio anchor to the Manual
Helpful for https://github.com/rust-lang/www.rust-lang.org/pull/1915 so we have a persistent place to link as "Visual Studio" from the Rust website.
Syntax reference: https://docs.asciidoctor.org/asciidoc/latest/sections/custom-ids/#assign-auxiliary-ids
2024-01-15 07:44:00 +00:00
David Tolnay
02d21f21cf
Add a stable #visual-studio anchor to the Manual
2024-01-14 10:54:20 -08:00
davidsemakula
d4b43d5a51
improve ordered use tree merging implementation
2024-01-14 19:49:50 +03:00
davidsemakula
db3f0f1761
improve use tree simple path comparison logic
2024-01-12 18:23:58 +03:00
davidsemakula
22ae5f49ba
order merged use trees
2024-01-12 17:05:23 +03:00
roife
df538288e0
internal: add inline for move_mask in line-index
2024-01-12 20:27:54 +08:00
Young-Flash
6033b66ce0
test: correct expected test result
2024-01-12 17:42:18 +08:00
Young-Flash
d0b310fc93
fix: add USE_TREE_LIST_FIRST_SET
2024-01-12 17:41:46 +08:00
roife
7c3744e4db
internal: Speedup line index calculation via NEON for aarch64
2024-01-12 15:58:56 +08:00
YangzeLuo
22cda959b3
fix: failed to infer OUT_DIR when workspace root contains symlink
2024-01-12 13:35:53 +08:00
Nicholas Nethercote
6001c50cac
Detect NulInCStr
error earlier.
...
By making it an `EscapeError` instead of a `LitError`. This makes it
like the other errors produced when checking string literals contents,
e.g. for invalid escape sequences or bare CR chars.
NOTE: this means these errors are issued earlier, before expansion,
which changes behaviour. It will be possible to move the check back to
the later point if desired. If that happens, it's likely that all the
string literal contents checks will be delayed together.
One nice thing about this: the old approach had some code in
`report_lit_error` to calculate the span of the nul char from a range.
This code used a hardwired `+2` to account for the `c"` at the start of
a C string literal, but this should have changed to a `+3` for raw C
string literals to account for the `cr"`, which meant that the caret in
`cr"` nul error messages was one short of where it should have been. The
new approach doesn't need any of this and avoids the off-by-one error.
2024-01-12 16:19:37 +11:00
davidsemakula
4a6b16bfbe
order use trees following rustfmt's algorithm for ordering imports
2024-01-11 20:04:45 +03:00
bors
9d8889cdfc
Auto merge of #16348 - Veykril:nested-includes, r=Veykril
...
fix: Fix nested includes resolving from the wrong base file
Fixes https://github.com/rust-lang/rust-analyzer/issues/16109
2024-01-11 11:53:24 +00:00
Young-Flash
45eea57115
add in-comment test case for use_tree_list_err_recovery
2024-01-11 19:52:23 +08:00
Young-Flash
afe05fe1d8
fix broken test
2024-01-11 19:51:45 +08:00
Young-Flash
e6dd522761
fix: add err recovery for use_tree_list parsing
2024-01-11 19:50:35 +08:00
bors
3e1ae6be21
Auto merge of #16347 - Veykril:find-path, r=Veykril
...
internal: Consider all kinds of explicit private imports in find_path
Builds on top of https://github.com/rust-lang/rust-analyzer/pull/16265 to make things a bit more general, now we consider all explicit private imports.
2024-01-11 11:42:08 +00:00
Lukas Wirth
215ede8497
fix: Fix nested includes resolving from the wrong base file
2024-01-11 12:41:47 +01:00
Lukas Wirth
b6e6d5d3af
internal: Consider all kinds of explicit private imports in find_path
2024-01-11 12:22:04 +01:00
bors
d5366b5c19
Auto merge of #16265 - Patryk27:suggest-pub-crate-imports, r=Veykril
...
fix: Acknowledge `pub(crate)` imports in import suggestions
rust-analyzer has logic that discounts suggesting `use`s for private imports, but that logic is unnecessarily strict - for instance given this code:
```rust
mod foo {
pub struct Foo;
}
pub(crate) use self::foo::*;
mod bar {
fn main() {
Foo$0;
}
}
```
... RA will suggest to add `use crate::foo::Foo;`, which not only makes the code overly verbose (especially in larger code bases), but also is disjoint with what rustc itself suggests.
This commit adjusts the logic, so that `pub(crate)` imports are taken into account when generating the suggestions; considering rustc's behavior, I think this change doesn't warrant any extra configuration flag.
Note that this is my first commit to RA, so I guess the approach taken here might be suboptimal - certainly feels somewhat hacky, maybe there's some better way of finding out the optimal import path 😅
2024-01-11 09:54:22 +00:00
Patryk Wychowaniec
76aaf17794
Suggest pub(crate)
imports
...
rust-analyzer has logic that discounts suggesting `use`s for private
imports, but that logic is unnecessarily strict - for instance given
this code:
```rust
mod foo {
pub struct Foo;
}
pub(crate) use self::foo::*;
mod bar {
fn main() {
Foo$0;
}
}
```
... RA will suggest to add `use crate::foo::Foo;`, which not only makes
the code overly verbose (especially in larger code bases), but also is
disjoint with what rustc itself suggests.
This commit adjusts the logic, so that `pub(crate)` imports are taken
into account when generating the suggestions; considering rustc's
behavior, I think this change doesn't warrant any extra configuration
flag.
Note that this is my first commit to RA, so I guess the approach taken
here might be suboptimal - certainly feels somewhat hacky, maybe there's
some better way of finding out the optimal import path 😅
2024-01-10 18:21:16 +01:00
bors
e4344f5fce
Auto merge of #16339 - Veykril:hashmaps, r=Veykril
...
Replace SourceRootCrates hashset output with slice for deterministic order
We only iterate over the result, and its pretty small in general so no point for the `HashSet` (additionally this way we get a more defined iteration order).
2024-01-10 14:10:10 +00:00
Lukas Wirth
4d3a0dc329
Replace SourceRootCrates hashset output with slice for deterministic order
2024-01-10 14:51:51 +01:00
bors
e5a1118265
Auto merge of #16330 - zheylmun:master, r=Veykril
...
minor: Mark unresolved associated item diagnostic as experimental
Per #16327 unresolved associated item has false positives. Mark the diagnostic as experimental until this is more dependable.
2024-01-10 12:10:30 +00:00
Zach
1aff8157bc
Set experimental field at diagnostic new instead of lib
2024-01-10 05:58:25 -06:00
bors
b201684982
Auto merge of #16274 - dfireBird:completion_score, r=Veykril
...
Add notable_trait predicate to `CompletionRelevance`
Given a score of 1 for now, will change as per reviews needed.
2024-01-10 11:16:52 +00:00
dfireBird
257870e09f
add tests to verify relevance of notable traits and some refactors
2024-01-10 16:30:22 +05:30
bors
1c9bb31970
Auto merge of #16209 - l1nxy:add-merge-nested-if, r=Veykril
...
feat: assist to merge nested if
resolve : #16095
2024-01-10 09:18:05 +00:00
bors
00eb8ce41e
Auto merge of #16271 - Veykril:gate-proc-macro-test, r=Veykril
...
Remove sysroot-abi feature flag from proc-macro-test
Closes https://github.com/rust-lang/rust-analyzer/issues/16194
2024-01-10 09:05:00 +00:00
Lukas Wirth
4b7b602da9
Remove sysroot-abi feature flag from proc-macro-test
2024-01-10 09:53:12 +01:00
bors
5871b61c0d
Auto merge of #16333 - roife:fix/issue-14371, r=Veykril
...
Preserve comments for extracted block expression in 'extract_function'
Fix #14371
Preserve comments for extracted block expression in 'extract_function'.
In the original implementation, `block.statements()` was used to construct a new function, removing the comments within the block. In the updated implementation, we use manual traversal of nodes and `hacky_block_expr` to generate a new block, thereby preserving the comments.
2024-01-10 08:09:38 +00:00
bors
f31b1fc617
Auto merge of #16334 - Veykril:salsa, r=Veykril
...
Bump salsa
2024-01-10 07:49:27 +00:00
Lukas Wirth
9c2d331e16
Bump salsa
2024-01-10 08:47:26 +01:00
roife
d327f3036c
Add test 'comments_in_block_expr' in in 'extract_function'
2024-01-10 15:00:58 +08:00
roife
bc54775c9d
Preserve comments for extracted block expr in 'extract_function' assist
2024-01-10 15:00:35 +08:00
Zach
beeaaf184e
Mark unresolved associated item diagnostic as experimental
2024-01-09 17:09:50 -06:00
bors
ae6e737724
Auto merge of #16329 - Veykril:perfperf, r=Veykril
...
internal: Some minor perf/memory improvements
2024-01-09 20:51:23 +00:00
Lukas Wirth
f8b130a6aa
unreachable pub
2024-01-09 21:35:22 +01:00