11743: fix: Properly unify receivers during method resolution r=flodiebold a=flodiebold
This fixes our type inference problems with `DynMap`; the problem there were the projection types in
```rust
impl<P: Policy> KeyMap<Key<P::K, P::V, P>>
```
which messed up the naive type equality check we did. It also actually simplifies the logic though, IMO. I also added a fix for associated const resolution that I noticed (visibility not being taken into account).
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
11740: Insert #[must_use] in generate_is_empty_from_len r=lnicola a=Walther
Inserts `#[must_use]` for the generated `is_empty` methods. I also added the `#[must_use]` for the `len()` methods in the documentation examples and tests for this generator while at it, to make sure they too encourage the use of the annotation.
From discussion in https://github.com/rust-analyzer/rust-analyzer/issues/11736 and https://github.com/rust-analyzer/rust-analyzer/pull/11738
Co-authored-by: Walther <veeti.haapsamo@gmail.com>
11694: fix: "Extract to function" assist preserves `break` and `continue` labels r=Veykril a=m0rg-dev
Adds a label / lifetime parameter to `ide_assists::handlers::extract_function::FlowKind::{Break, Continue}`, adds support for emitting labels to `syntax::ast::make::{expr_break, expr_continue}`, and implements the required machinery to let `extract_function` make use of them.
This does modify the external API of the `syntax` crate, but the changes there are simple, not used outside `ide_assists`, and, well, we should probably support emitting `break` and `continue` labels through `syntax` anyways, they're part of the language spec.
Closes#11413.
Co-authored-by: Morgan Thomas <corp@m0rg.dev>
11708: Update manual for inlay hint customization r=Veykril a=ian-h-chamberlain
Related to #6405, #6883 but not sure if they should be closed or not as this is just a documentation update.
This functionality was changed as of #11445 and now can be customized using native VSCode settings instead of `rust-analyzer`-specific ones.
Co-authored-by: Ian Chamberlain <ian-h-chamberlain@users.noreply.github.com>
11710: editors/code: fix crash due to missing ID= field r=lnicola a=cab404
Assuming ID=linux by default.
Also removed toLowerCase — it really shouldn't be needed.
Fixes#11709
Co-authored-by: Vladimir Serov <me@cab404.ru>
Assuming ID=linux in isNixOs by default. You can get away with
default "", but why do that if there's a default value in spec?)
Also removed toLowerCase — it really shouldn't be needed.
Fixes#11709
Closes#6883
This functionality was changed as of #11445 and now can be customized using native VSCode settings instead of `rust-analyzer`-specific ones.
11688: Add const generics r=HKalbasi a=HKalbasi
#7434 is not in this PR, so there is no evaluation of constants and no default const argument. But the rest (type inference and method resolution with chalk) should work.
Chalk is pedantic about kind of generic arguments, and will panic in case of mixing type and const arguments. I tried to add test that, but I'm not sure if it covers all cases.
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
11696: editors/code: fix nixos detection r=lnicola a=cab404
Problem: NixOS started using quotes around it's id field in /etc/os-release
Solution: Parially parsing os-release, and detecting, whether `nixos` appears anywhere in "ID=" field\
See https://github.com/rust-analyzer/rust-analyzer/issues/11695Closes#11695
Co-authored-by: Vladimir Serov <me@cab404.ru>
Adds a label / lifetime parameter to `ide_assists::handlers::extract_function::FlowKind::{Break, Continue}`, adds support for emitting labels to `syntax::ast::make::{expr_break, expr_continue}`, and implements the required machinery to let `extract_function` make use of them.
This does modify the external API of the `syntax` crate, but the changes there are simple, not used outside `ide_assists`, and, well, we should probably support emitting `break` and `continue` labels through `syntax` anyways, they're part of the language spec.
Closes#11413.