Skip to content

Conversation

@lnicola
Copy link
Member

@lnicola lnicola commented Nov 27, 2025

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

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
lnicola and others added 7 commits November 27, 2025 05:34
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
@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 out-of-band sync to fix a proc macro server bug

@bors
Copy link
Collaborator

bors commented Nov 27, 2025

📌 Commit 7f93ba5 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
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to rust-lang/rust-analyzer@c9472ba.

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

r? `@ghost`
@bors
Copy link
Collaborator

bors commented Nov 27, 2025

⌛ Testing commit 7f93ba5 with merge 3a1dc63...

@lnicola
Copy link
Member Author

lnicola commented Nov 27, 2025

@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 Nov 27, 2025
@matthiaskrgr
Copy link
Member

@lnicola @bors retry r- should stop the ci jobs if you want to do that

@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 Nov 27, 2025
@matthiaskrgr
Copy link
Member

ah why does it parse that if its inside code blocks -_-

@lnicola
Copy link
Member Author

lnicola commented Nov 27, 2025

Perfect!

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Nov 27, 2025

@bors retry r-

(idk something was weird)

@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 Nov 27, 2025
@lnicola lnicola closed this Nov 27, 2025
@lnicola lnicola deleted the sync-from-ra branch November 27, 2025 16:15
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.