10631: fix: Fix postfix completions panicking r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10243, I couldn't reproduce the panic with the given snippet, but this change should still guard against it.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
10630: fix: Don't ask the user to reload when chaning HoverAction configs in VSCode r=Veykril a=Veykril
To my knowledge, all of these are re-read on hover requests so there is no longer a reason to reload when changing these.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
10617: Set MSRV r=Veykril a=lnicola
Set the MSRV to `1.56` since we're already on the 2021 edition and building with older version fails.
From now on, there'll be a change in behavior: `xtask install` used to warn on old toolchains, but now the user will get an error. This isn't so bad because:
- the check in `xtask install` wasn't always working (because sometimes `xtask` itself required a newer toolchain)
- we generally bump the required version for a reason (when using a newer feature). We might forget to bump it, but when we do, older toolchains won't work
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
10608: Amend the instruction for rustup. r=lnicola a=jhscheer
The current instruction for installation via rustup are misleading.
Co-authored-by: Jan Scheer <jhscheer@users.noreply.github.com>
10603: fix: Don't resolve attributes to non attribute macros r=Veykril a=Veykril
Also changes `const`s to `static`s for `Limit`s as we have interior mutability in those(though only used with a certain feature flag enabled).
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
10563: feat: Make "Generate getter" assist use semantic info r=agluszak a=agluszak
This PR makes "Generate getter" assist use semantic info instead of dealing with types encoded as strings.
Getters for types which are:
- `Copy` no longer return references
- `AsRef<str>` (i.e. `String`) return `&str` (instead of `&String`)
- `AsRef<[T]>` (i.e. `Vec<T>`) return `&[T]` (instead of `&Vec<T>`)
- `AsRef<T>` (i.e. `Box<T>`) return `&T` (instead of `&Box<T>`)
- `Option<T>` return `Option<&T>` (instead of `&Option<T>`)
- `Result<T, E>` return `Result<&T, &E>` (instead of `&Result<T, E>`)
String, Vec, Box and Option were previously handled as special cases.
Closes#10295
Co-authored-by: Andrzej Głuszak <gluszak.andrzej@gmail.com>
10387: Move `IdxRange` into la-arena r=Veykril a=arzg
Currently, `IdxRange` (named `IdRange`) is located in `hir_def::item_tree`, when really it isn’t specific to `hir_def` and could become part of la-arena. The rename from `IdRange` to `IdxRange` is to maintain consistency with the naming convention used throughout la-arena (`Idx` instead of `Id`, `RawIdx` instead of `RawId`). This PR also adds a few new APIs to la-arena on top of `IdxRange` for convenience, namely:
- indexing into an `Arena` by an `IdxRange` and getting a slice of values back
- creating an `IdxRange` from an inclusive range
Currently this PR also exposes a new `Arena::next_idx` method to make constructing inclusive`IdxRange`s using `IdxRange::new` easier; however, it would in my opinion be better to remove this as it allows for easy creation of out-of-bounds `Idx`s, when `IdxRange::new_inclusive` mostly covers the same use-case while being less error-prone.
I decided to bump the la-arena version to 0.3.0 from 0.2.0 because adding a new `Index` impl for `Arena` turned out to be a breaking change: I had to add a type hint in `crates/hir_def/src/body/scope.rs` when one wasn’t necessary before, since rustc couldn’t work out the type of a closure parameter now that there are multiple `Index` impls. I’m not sure whether this is the right decision, though.
Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
10600: minor: Make some functions non-generic r=Veykril a=lnicola
This reduces `text` size by 10192 bytes (0.064% 😢), with no apparent change in performance.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
10589: Fix: expand into {} if the glob import is unused r=lnicola a=rainy-me
close#10524
I think the second `expand into {}` behavior is genuinely better. (maybe this should been labeled with good first issue xd)
Co-authored-by: rainy-me <github@yue.coffee>