Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ rust-analyzer #112305

Merged
merged 802 commits into from
Jun 5, 2023
Merged

⬆️ rust-analyzer #112305

merged 802 commits into from
Jun 5, 2023

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Jun 5, 2023

r? @ghost

Veykril and others added 30 commits May 8, 2023 09:50
…kril

feat: Closure capture inlay hints

I opted for a fictional `move(foo, &bar, &mut qux)` syntax here, disabled by default as these are not correct rust syntax and hence could cause confusion.
![image](https://user-images.githubusercontent.com/3757771/236447484-649a4ea6-ad61-496e-bad8-765a5236150e.png)
Fix manual formatting and remove duplicate command
minor: Hide deps panel outside of Rust projects and set missing category

Closes rust-lang#14760
More APIs for `la_arena::IdxRange`

```rust
impl<T> ExactSizeIterator for IdxRange<T>;

impl<T> Arena<T> {
    pub fn alloc_many<II: IntoIterator<Item = T>>(&mut self, iter: II) -> IdxRange<T>;
}
```

1. There are no currently ways to get `IdxRange` without manually offseting `Idx`. Providing a method for multiple-allocation simplifies this process and makes it less error-prone.
2. `IdxRange: ExactSizeIterator` makes `iter.zip(range).rev()` possible. Since `Zip: DoubleEndedIterator` requires all its arguments to be `ExactSizeIterator`. It also ease the usage for, eg. `len()`.
3. Fixed a typo.

I noticed that `IdxRange::end` may be invalid. Is it good to return `Idx` instead of `RawIdx`?
Add basic support for `augmentsSyntaxTokens` and non-standard semantic token config

cc rust-lang#12783
Closes rust-lang/rust-analyzer#13066
We've already removed non-sysroot proc macro server, which effectively
removed support for Rust <1.64.0, so this removal of fallback path
shouldn't be problem at this point.
…=Veykril

Introduce macro sub-namespaces and `macro_use` prelude

This PR implements two mechanisms needed for correct macro name resolution: macro sub-namespace and `macro_use` prelude.

- [macro sub-namespaces][subns-ref]

  Macros have two sub-namespaces: one for function-like macro and the other for those in attributes (including custom derive macros). When we're resolving a macro name for function-like macro, we should ignore non-function-like macros, and vice versa.

  This helps resolve single-segment macro names because we can (and should, as rustc does) fallback to names in preludes when the name in the current module scope is in different sub-namespace.

- [`macro_use` prelude][prelude-ref]

  `#[macro_use]`'d extern crate declarations (including the standard library) bring their macros into scope, but they should not be prioritized over local macros (those defined in place and those explicitly imported).

  We have been bringing them into legacy (textual) macro scope, which has the highest precedence in name resolution. This PR introduces the `macro_use` prelude in crate-level `DefMap`s, whose precedence is lower than local macros but higher than the standard library prelude.

The first 3 commits are drive-by fixes/refactors.

Fixes rust-lang#8828 (prelude)
Fixes rust-lang#12505 (prelude)
Fixes rust-lang#12734 (prelude)
Fixes rust-lang#13683 (prelude)
Fixes rust-lang#13821 (prelude)
Fixes rust-lang#13974 (prelude)
Fixes rust-lang#14254 (namespace)

[subns-ref]: https://doc.rust-lang.org/reference/names/namespaces.html#sub-namespaces
[prelude-ref]: https://doc.rust-lang.org/reference/names/preludes.html#macro_use-prelude
fix: Add macro modifier for highlighting tokens in macro calls

Followup to rust-lang/rust-analyzer#14777 we have to tell the client about the semantic tokens inside macro calls as those can be remapped. Adding a modifier will force this behavior.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 5, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jun 5, 2023

Some changes occurred in src/tools/rust-analyzer

cc @rust-lang/rust-analyzer

@lnicola
Copy link
Member Author

lnicola commented Jun 5, 2023

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Jun 5, 2023

📌 Commit b8a7d43 has been approved by lnicola

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 5, 2023
@rust-log-analyzer

This comment has been minimized.

@lnicola
Copy link
Member Author

lnicola commented Jun 5, 2023

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 5, 2023
@lnicola
Copy link
Member Author

lnicola commented Jun 5, 2023

@Veykril we don't have that feature in crates/rust-analyzer/Cargo.toml, but the test works fine on our side. Maybe you can spot what's wrong?

@lnicola lnicola marked this pull request as draft June 5, 2023 09:52
@Urgau
Copy link
Member

Urgau commented Jun 5, 2023

The feature was removed in rust-lang/rust-analyzer@c21860b#diff-520e21205f2074cf2309045ac5b868b4fbf2192fe75ff249aa287e01d183bf8c but the gated test was not removed or adjusted. Hope this helps.

@Veykril
Copy link
Member

Veykril commented Jun 5, 2023

Oh that was a mistake, the feature should've stayed there I think. The test is still wanted.

@lnicola lnicola marked this pull request as ready for review June 5, 2023 12:17
@lnicola
Copy link
Member Author

lnicola commented Jun 5, 2023

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Jun 5, 2023

📌 Commit 6c1f108 has been approved by lnicola

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 5, 2023
@bors
Copy link
Contributor

bors commented Jun 5, 2023

⌛ Testing commit 6c1f108 with merge 2f896da...

@bors
Copy link
Contributor

bors commented Jun 5, 2023

☀️ Test successful - checks-actions
Approved by: lnicola
Pushing 2f896da to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 5, 2023
@bors bors merged commit 2f896da into rust-lang:master Jun 5, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 5, 2023
@lnicola lnicola deleted the sync-from-ra branch June 5, 2023 16:51
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2f896da): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.2% [0.7%, 1.8%] 16
Regressions ❌
(secondary)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.2% [0.7%, 1.8%] 16

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.8% [0.8%, 0.8%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 646.59s -> 646.24s (-0.05%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.