-
Notifications
You must be signed in to change notification settings - Fork 14k
rust-analyzer subtree update
#149390
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
Merged
Merged
rust-analyzer subtree update
#149390
+1,603
−362
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example --- ```rust #![attr] $0 ``` **Before this PR** Empty completion list **After this PR** ```text ma makro!(…) macro_rules! makro md module kw async kw const kw crate:: kw enum kw extern kw fn kw impl kw impl for kw mod kw pub kw pub(crate) kw pub(super) kw self:: kw static kw struct kw trait kw type kw union kw unsafe kw use sn macro_rules sn tfn (Test function) sn tmod (Test module) ```
Example
---
```rust
enum Enum<T> {
Unit,
Tuple(T),
}
type EnumAlias<T> = Enum<T>;
fn f(x: EnumAlias<u8>) {
match x {
$0 => (),
_ => (),
}
}
```
**Before this PR**
```text
en Enum
bn Enum::Tuple(…) Enum::Tuple($1)$0
bn Enum::Unit Enum::Unit$0
kw mut
kw ref
```
**After this PR**
```text
en Enum
ta EnumAlias
bn Enum::Tuple(…) Enum::Tuple($1)$0
bn Enum::Unit Enum::Unit$0
kw mut
kw ref
```
Example
---
**std example**:
```rust
fn foo(nums: std::rc::Rc<[i32]>) {
nums.$0
}
```
---
**minicore example**:
```rust
struct Foo;
impl Foo { fn iter(&self) -> Iter { Iter } }
impl IntoIterator for &Foo {
type Item = ();
type IntoIter = Iter;
fn into_iter(self) -> Self::IntoIter { Iter }
}
struct Ref;
impl core::ops::Deref for Ref {
type Target = Foo;
fn deref(&self) -> &Self::Target { &Foo }
}
struct Iter;
impl Iterator for Iter {
type Item = ();
fn next(&mut self) -> Option<Self::Item> { None }
}
fn foo() {
Ref.$0
}
```
**Before this PR**
```text
me deref() (use core::ops::Deref) fn(&self) -> &<Self as Deref>::Target
me into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
me iter() fn(&self) -> Iter
```
**After this PR**
```text
me deref() (use core::ops::Deref) fn(&self) -> &<Self as Deref>::Target
me into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
me iter() fn(&self) -> Iter
me iter().by_ref() (as Iterator) fn(&mut self) -> &mut Self
me iter().into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
me iter().next() (as Iterator) fn(&mut self) -> Option<<Self as Iterator>::Item>
me iter().nth(…) (as Iterator) fn(&mut self, usize) -> Option<<Self as Iterator>::Item>
```
Examples
---
```rust
enum Variant {
Undefined,
$0Minor,
M$0ajor,
}
```
->
```rust
enum Variant {
Undefined,
Minor,
Major,
}
impl Variant {
/// Returns `true` if the variant is [`Minor`].
///
/// [`Minor`]: Variant::Minor
#[must_use]
fn is_minor(&self) -> bool {
matches!(self, Self::Minor)
}
/// Returns `true` if the variant is [`Major`].
///
/// [`Major`]: Variant::Major
#[must_use]
fn is_major(&self) -> bool {
matches!(self, Self::Major)
}
}
```
---
```rust
enum Value {
Unit(()),
$0Number(i32),
Text(String)$0,
}
```
->
```rust
enum Value {
Unit(()),
Number(i32),
Text(String),
}
impl Value {
fn try_into_number(self) -> Result<i32, Self> {
if let Self::Number(v) = self {
Ok(v)
} else {
Err(self)
}
}
fn try_into_text(self) -> Result<String, Self> {
if let Self::Text(v) = self {
Ok(v)
} else {
Err(self)
}
}
}
```
---
```rust
enum Value {
Unit(()),
$0Number(i32),
Text(String)$0,
}
```
->
```rust
enum Value {
Unit(()),
Number(i32),
Text(String),
}
impl Value {
fn as_number(&self) -> Option<&i32> {
if let Self::Number(v) = self {
Some(v)
} else {
None
}
}
fn as_text(&self) -> Option<&String> {
if let Self::Text(v) = self {
Some(v)
} else {
None
}
}
}
```
This adds a type_of_type_placeholder arena to InferenceResult to record which type a given type placeholder gets inferred to.
This uses the new InferenceResult::type_of_type_placeholder data to turn type references into completely resolved types instead of just returning the lexical type.
When met with types with placeholders, this ensures this assist
extracts the inferred type instead of the type with placeholders.
For instance, when met with this code:
```
fn main() {
let vec: Vec<_> = vec![4];
}
```
selecting Vec<_> and extracting an alias will now yield `Vec<i32>`
instead of `Vec<_>`.
With the extra InferenceResult that maps type placeholders to their inferred type, we can now easily display inlay hints for them.
…pzznu Use inferred type in “extract type as type alias” assist and display inferred type placeholder `_` inlay hints
minor: add regression tests for add_missing_impl_members
…port-for-postcard Integrate postcard support into proc-macro server CLI
Basic support for declarative attribute/derive macros
Example
---
```rust
fn foo() { bar(, $0); }
fn bar(x: u32, y: i32) {}
```
**Before this PR**
```text
ty: u32, name: x
```
**After this PR**
```text
ty: i32, name: y
```
This increases the binary size of `rust-analyzer.exe` from 42.4 MB to 42.6 MB. Which should be acceptable for eliminating 7 DLL dependencies.
fix: fix parameter info with missing arguments
Build releases with static CRT for `-windows-msvc` targets.
completions: Fix completions disregarding snippet capabilities
fix: Do not try to connect via postcard to proc-macro-srv
…-json fix: Fix proc-macro-srv protocol read implementation
internal: Gate spawning proc-macro-srv with --format on toolchain version
This updates the rust-version file to 1be6b13.
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 1be6b13 Filtered ref: 53d2132341f509072e83b49d4d82f17465ab164c Upstream diff: rust-lang/rust@6159a44...1be6b13 This merge was created using https://github.com/rust-lang/josh-sync.
minor: sync from downstream
Add multiple generate for enum generate is, as, try_into
Fix not complete type alias in pattern
…-attr Fix not complete after inner-attr in source-file
Fix skipiter not applicable in autoderef
…ailing whitespace
proc-macro-srv: Fix `<TokenStream as Display>::fmt` impl producing trailing whitespace
proc-macro-srv: Fix `<TokenStream as Display>::fmt` impl rendering puncts as u8
Collaborator
|
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
Member
Author
|
@bors r+ p=2 sync rust-analyzer proc macro server fixes |
Collaborator
bors
added a commit
that referenced
this pull request
Nov 27, 2025
Rollup of 8 pull requests Successful merges: - #147071 (constify from_fn, try_from_fn, try_map, map) - #148930 (tweak editor configs) - #149320 (-Znext-solver: normalize expected function input types when fudging) - #149363 (Port the `#![windows_subsystem]` attribute to the new attribute system) - #149378 (make run-make tests use 2024 edition by default) - #149381 (Add `impl TrustedLen` on `BTree{Map,Set}` iterators) - #149388 (remove session+blob decoder construction) - #149390 (`rust-analyzer` subtree update) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Nov 27, 2025
Rollup merge of #149390 - lnicola:sync-from-ra, r=lnicola `rust-analyzer` subtree update Subtree update of `rust-analyzer` to rust-lang/rust-analyzer@a2a4a95. Created using https://github.com/rust-lang/josh-sync. r? `@ghost`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-rust-analyzer
Relevant to the rust-analyzer team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Subtree update of
rust-analyzerto rust-lang/rust-analyzer@a2a4a95.Created using https://github.com/rust-lang/josh-sync.
r? @ghost