Skip to content

Conversation

@lnicola
Copy link
Member

@lnicola lnicola commented Nov 27, 2025

Subtree update of rust-analyzer to rust-lang/rust-analyzer@a2a4a95.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost

A4-Tacks and others added 30 commits November 6, 2025 14:53
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
Veykril and others added 15 commits November 26, 2025 10:16
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.
Add multiple generate for enum generate is, as, try_into
…-attr

Fix not complete after inner-attr in source-file
Fix skipiter not applicable in autoderef
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
@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2025

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. labels Nov 27, 2025
@lnicola
Copy link
Member Author

lnicola commented Nov 27, 2025

@bors r+ p=2 sync rust-analyzer proc macro server fixes

@bors
Copy link
Collaborator

bors commented Nov 27, 2025

📌 Commit ac118f9 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 Nov 27, 2025
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
@bors bors merged commit b2f8c16 into rust-lang:main Nov 27, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 27, 2025
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`
@lnicola lnicola deleted the sync-from-ra branch November 28, 2025 08:27
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.