Commit graph

710 commits

Author SHA1 Message Date
Mark Rousskov
94a4279fba Allow deprecated temporarily to unblock version bump 2024-07-20 15:51:58 -04:00
bors
a91f7d72f1 Auto merge of #127617 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-07-16 10:54:30 +00:00
Laurențiu Nicola
3e73272ac7 Use re-exported Idx and IndexVec in pat_analysis 2024-07-16 10:41:13 +03:00
Jubilee
1d59d22ac1
Rollup merge of #127434 - onur-ozkan:use-bootstrap-instead-of-rustbuild, r=Mark-Simulacrum
use "bootstrap" instead of "rustbuild" in comments and docs

Let's stick with the single name "bootstrap" to refer to the bootstrap project to avoid confusion. This should make it clearer, especially for new contributors.
2024-07-13 20:19:45 -07:00
Laurențiu Nicola
62bbce2ad2 Merge from rust-lang/rust 2024-07-11 20:06:05 +03:00
Laurențiu Nicola
b159b3fd80 Preparing for merge from rust-lang/rust 2024-07-11 20:05:52 +03:00
bors
45609a995e Auto merge of #17571 - winstxnhdw:bool-to-enum-no-dupe, r=Veykril
feat: do not add new enum if it already exists

## Summary

This PR introduces a check for the existence of another enum within the current scope, and if it exist, we skip `add_enum_def`.

## Why?

Currently, when using the `bool_to_enum` assist more than once, it is possible to add multiple enum definitions. For example, the following snippet,

```rs
#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

fn main() {
    let a = Bool::True;
    let b = true;
    println!("Hello, world!");
}
```

will be transformed into,

```rs
#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

#[derive(PartialEq, Eq)]
enum Bool {
    True,
    False,
}

fn main() {
    let a = Bool::True;
    let b = Bool::True;
    println!("Hello, world!");
}
```

This can be annoying for users to clean up.
2024-07-11 08:55:34 +00:00
winstxnhdw
d33e96ba00 refactor: search for enum semantically 2024-07-10 21:13:13 +01:00
Lukas Wirth
d4a6970ded Remove faq landing page, improve main one 2024-07-10 19:05:32 +02:00
bors
8cc4de631b Auto merge of #17572 - beetrees:f16-f128, r=Veykril
Add `f16` and `f128` support

Adds `f16` and `f128` support, using the `rustc_apfloat` library (also used by `rustc`) for parsing/arithmetic/displaying since the types aren't stable yet so can't be used by rust-analyzer itself.

Issue: #17451
2024-07-10 10:04:30 +00:00
bors
2faa2cb0db Auto merge of #17544 - MikeWalrus:inlay-hint-generic-param-name, r=Veykril
feat: add inlay hints for generic parameters

fixes #11091

By default, only hints for const generic parameters are shown, and this can be configured through `rust-analyzer.inlayHints.genericParameterHints.enable`.

Probably needs more testing.
2024-07-10 09:50:40 +00:00
Lukas Wirth
7da4615763
Remove dead code in config.rs 2024-07-10 11:49:11 +02:00
beetrees
69424f7666
Add f16 and f128 support 2024-07-10 10:43:14 +01:00
winstxnhdw
15f08032bf style: prefer type inference
- unrelated to the PR but I wanted to change this in #17467
2024-07-09 22:30:00 +01:00
winstxnhdw
36c344ee97 feat: do not add new enum if it already exists 2024-07-09 22:17:07 +01:00
bors
5445aef843 Auto merge of #17558 - beetrees:fix-double-rounding, r=Veykril
fix: Fix double rounding of `f32` literals

Fixes #17556 by delaying parsing until the type is known. Also adds a test to check the issue is fixed.
2024-07-08 16:10:58 +00:00
beetrees
da41ae7b3a
fix: Fix double rounding of f32 literals 2024-07-08 16:31:32 +01:00
mo8it
a8e90c8f4d Remove version check before using --keep-going 2024-07-08 16:41:12 +02:00
Matthias Krüger
c4ee2df539
Rollup merge of #120248 - WaffleLapkin:bonk-ptr-object-casts, r=compiler-errors,oli-obk,lnicola
Make casts of pointers to trait objects stricter

This is an attempt to `fix` https://github.com/rust-lang/rust/issues/120222 and https://github.com/rust-lang/rust/issues/120217.

This is done by adding restrictions on casting pointers to trait objects.

Before this PR the rules were as follows:

> When casting `*const X<dyn A>` -> `*const Y<dyn B>`, principal traits in `A` and `B` must refer to the same trait definition (or no trait).

With this PR the rules are changed to

> When casting `*const X<dyn Src>` -> `*const Y<dyn Dst>`
> - if `Dst` has a principal trait `DstP`,
>   - `Src` must have a principal trait `SrcP`
>   - `dyn SrcP` and `dyn DstP` must be the same type (modulo the trait object lifetime, `dyn T+'a` -> `dyn T+'b` is allowed)
>   - Auto traits in `Dst` must be a subset of auto traits in `Src`
>     - Not adhering to this is currently a FCW (warn-by-default + `FutureReleaseErrorReportInDeps`), instead of an error
> - if `Src` has a principal trait `Dst` must as well
>   - this restriction will be removed in a follow up PR

This ensures that
1. Principal trait's generic arguments match (no `*const dyn Tr<A>` -> `*const dyn Tr<B>` casts, which are a problem for [#120222](https://github.com/rust-lang/rust/issues/120222))
2. Principal trait's lifetime arguments match (no `*const dyn Tr<'a>` -> `*const dyn Tr<'b>` casts, which are a problem for [#120217](https://github.com/rust-lang/rust/issues/120217))
3. No auto traits can be _added_ (this is a problem for arbitrary self types, see [this comment](https://github.com/rust-lang/rust/pull/120248#discussion_r1463835350))

Some notes:
 - We only care about the metadata/last field, so you can still cast `*const dyn T` to `*const WithHeader<dyn T>`, etc
- The lifetime of the trait object itself (`dyn A + 'lt`) is not checked, so you can still cast `*mut FnOnce() + '_` to `*mut FnOnce() + 'static`, etc
  - This feels fishy, but I couldn't come up with a reason it must be checked

The diagnostics are currently not great, to say the least, but as far as I can tell this correctly fixes the issues.

cc `@oli-obk` `@compiler-errors` `@lcnr`
2024-07-08 16:28:15 +02:00
Liao Junxuan
4988a497fd
feat: add inlay hints for generic parameters
fixes #11091

By default, only hints for const generic parameters are shown.
2024-07-08 19:11:41 +08:00
mo8it
4b482bc90d Add --keep-going to the check command 2024-07-07 18:37:02 +02:00
bors
fafacf3e9a Auto merge of #17555 - Veykril:grammar-inline, r=Veykril
internal: Inline generated syntax methods
2024-07-07 09:21:04 +00:00
Lukas Wirth
0ee4ff2496 Inline all the things 2024-07-07 11:18:40 +02:00
Lukas Wirth
87a62044fe HasGenericArgs syntax trait 2024-07-07 11:18:28 +02:00
bors
9a04253016 Auto merge of #17523 - wada314:master, r=Veykril
Add an option to use "::" for the external crate prefix.

Fixes #11823 .
Hi I'm very new to rust-analyzer and not sure how the review process are. Can somebody take a look at this PR? thanks!
2024-07-07 08:32:46 +00:00
Lukas Wirth
ba9f93e845 fix: Fix callHierarchy LSP violation 2024-07-07 10:14:47 +02:00
Lukas Wirth
77bca5306c Fix stale reference in architecture.md 2024-07-07 09:19:09 +02:00
Lukas Wirth
7a2c8c2b39 Run codegen commands as tests if their results are commited 2024-07-07 09:14:50 +02:00
Lukas Wirth
6f346c91be Re-implement tidy as an xtask action 2024-07-07 09:12:16 +02:00
Lukas Wirth
d00f4749b1 re-generate feature docs in release 2024-07-07 09:01:35 +02:00
Lukas Wirth
58ec8b2028 Drop sourcegen 2024-07-07 09:00:19 +02:00
Lukas Wirth
2d14f47eb7 Move feature-doc generation to xtask codegen 2024-07-07 09:00:18 +02:00
Lukas Wirth
4465fff75e Update hover test fixture 2024-07-07 08:55:10 +02:00
Lukas Wirth
e96601bbe0 Move parser test generation to xtask 2024-07-07 08:51:19 +02:00
Lukas Wirth
004a24e808 Allow new clippy lint in test 2024-07-07 08:41:41 +02:00
Lukas Wirth
7deebd6792 Fix stop_watch on linux 2024-07-07 08:40:41 +02:00
Lukas Wirth
7dfc583b0e Update generated lint definitions 2024-07-07 08:35:18 +02:00
Lukas Wirth
20dc1b615d Drop unused profile things 2024-07-07 08:24:10 +02:00
Lukas Wirth
faa13cbe20 fix: Fix parameter completions using macro expanded source ranges 2024-07-07 08:11:16 +02:00
Lukas Wirth
070f95c12e Move capability querying out of the config module 2024-07-07 07:42:12 +02:00
onur-ozkan
48192701e0 use "bootstrap" instead of "rustbuild" in comments and docs
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-07 00:07:08 +03:00
bors
9194c7a5e9 Auto merge of #17551 - Veykril:has-errors, r=Veykril
Also mark InferenceResult::has_errors flag when there are error types

Should work around https://github.com/rust-lang/rust-analyzer/issues/15090#issuecomment-2211647133
2024-07-06 18:56:23 +00:00
Lukas Wirth
725e15fc80 Also mark InferenceResult::has_errors flag when there are error types 2024-07-06 20:45:23 +02:00
bors
e907f8175c Auto merge of #17549 - Veykril:runnables-fix, r=Veykril
fix: Fix runnables being incorrectly constructed

I've misunderstood parts of the code here which caused runnables to arbitrarily break :) (I have yet to understand the conditions that made them break though, there is some odd caching involved I feel like ...)
Fixes https://github.com/rust-lang/rust-analyzer/issues/17402
2024-07-06 18:24:30 +00:00
Lukas Wirth
807fdd6ab1 fix: Fix runnables being incorrectly constructed 2024-07-06 20:23:14 +02:00
bors
162ecedd99 Auto merge of #17548 - Veykril:debug-fix, r=Veykril
fix: Fix passing `message-format` after -- in debugging

Fixes https://github.com/rust-lang/rust-analyzer/pull/17495#issuecomment-2211717224
2024-07-06 16:04:53 +00:00
Lukas Wirth
28981813e6 Fix passing message-format after -- in debugging 2024-07-06 18:03:33 +02:00
bors
98238b53b9 Auto merge of #17547 - Veykril:runnables-env, r=Veykril
internal: Clean up runnable lsp extension

This feels like a natural addition to me, and also allows us to drop the expect-test hardcoding from the extension. Additionally, `cargoExtraArgs` is pointless, all the client will do is merge it with `cargoArgs` so the server can do that instead of delegating that to the client.
2024-07-06 15:02:41 +00:00
Lukas Wirth
ac4e6c3046 Don't emit current dir as cwd for runnables 2024-07-06 16:44:57 +02:00
Lukas Wirth
9959546c8a Flatten cargoExtraArgs away from the runnable lsp extension 2024-07-06 16:36:27 +02:00