-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Rollup of 8 pull requests #149397
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
Rollup of 8 pull requests #149397
Conversation
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
`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`
|
@bors r+ rollup=never p=5 |
|
☀️ Test successful - checks-actions |
|
📌 Perf builds for each rolled up PR:
previous master: f392ed53ca In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing f392ed5 (parent) -> c86564c (this PR) Test differencesShow 454 test diffsStage 0
Stage 1
Stage 2
(and 168 additional test diffs) Additionally, 186 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard c86564c412a5949088a53b665d8b9a47ec610a39 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (c86564c): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 3.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 5.0%, secondary 1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 472.637s -> 474.675s (0.43%) |
Successful merges:
#![windows_subsystem]attribute to the new attribute system #149363 (Port the#![windows_subsystem]attribute to the new attribute system)impl TrustedLenonBTree{Map,Set}iterators #149381 (Addimpl TrustedLenonBTree{Map,Set}iterators)rust-analyzersubtree update #149390 (rust-analyzersubtree update)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup