Commit graph

710 commits

Author SHA1 Message Date
Lukas Wirth
0859772dbe Add environment to runnable lsp extension 2024-07-06 16:20:25 +02:00
bors
e33dcc6ab2 Auto merge of #17508 - jjoeldaniel:landing-page, r=Veykril
feat: Add landing/faq walkthrough pages

This is a basic implementation of a landing and FAQ page; I've included the bare-bones information as well as a [recommended section on inlay hints](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Landing.20Page/near/446135321).

I've also added `rust-analyzer: Open Walkthrough` and `rust-analyzer: Open FAQ` commands for ease of access.

I am hoping to create a small list of FAQ to include that might be useful as well as any other information I may have missed in the landing page. Feel free to share any suggestions!

![landing/faq page demo](https://github.com/rust-lang/rust-analyzer/assets/100006388/4644e4f0-4555-4b29-83c1-b048084ad63d)

cc #13351
2024-07-06 13:59:36 +00:00
Lukas Wirth
e8be2a0ac5 Diagnose unresolved self value in path expression 2024-07-06 15:44:12 +02:00
Michael Goulet
31fe9628cf
Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelix
Improve dead code analysis

Fixes #120770

1. check impl items later if self ty is private although the trait method is public, cause we must use the ty firstly if it's private
2. mark the adt live if it appears in pattern, like generic argument, this implies the use of the adt
3. based on the above, we can handle the case that private adts impl Default, so that we don't need adding rustc_trivial_field_reads on Default, and the logic in should_ignore_item

r? ``@pnkfelix``
2024-07-05 20:49:31 -04:00
Maybe Lapkin
06863eeebf Delete CloneAny from rust-analyzer's fork of AnyMap
...because it's very sketchy and causes FCWs.
In this case it *is* actually sound, but still.

I should write a better fork of anymap...
2024-07-04 17:57:31 +02:00
Shoyu Vanilla
90814f4170 Disallow nested impl traits 2024-07-04 23:31:55 +09:00
mu001999
0adb82528f Improve dead code analysis 2024-07-04 22:05:00 +08:00
bors
58bf5936c0 Auto merge of #17536 - Veykril:syntax-diags, r=Veykril
fix: Don't emit semantic diagnostics in files with a lot of syntax errors

These will only add to the noise when something very unexpected breaks or where parser recovery fails to kick in.
2024-07-03 09:01:48 +00:00
Lukas Wirth
87da256395 fix: Don't emit semantic diagnostics in files with a lot of syntax errors 2024-07-03 10:59:46 +02:00
Lukas Wirth
5e60845f52 Fix up the syntax tree for macro 2.0 2024-07-03 10:41:19 +02:00
Lukas Wirth
8f8f440cb2 Skip match exhaustiveness checking if pattern type contains errors 2024-07-03 08:31:40 +02:00
Lukas Wirth
0fef8f01a3 Move lifetimes in front of type and const params but after self 2024-07-02 14:17:34 +02:00
Lukas Wirth
99e432d253 Make GenericParams::lifetimes private 2024-07-02 13:45:53 +02:00
Lukas Wirth
446e15484c Make GenericParams::where_predicates private 2024-07-02 13:45:50 +02:00
Lukas Wirth
1da9ade53d Make GenericParams::type_or_consts private 2024-07-02 13:45:48 +02:00
Lukas Wirth
5fa5378856 Fix lifetime parameters moving paramter defaults 2024-07-02 12:34:32 +02:00
Shohei Wada
f398be1639 squash. 2024-07-02 01:52:34 +09:00
Lukas Wirth
fe9337311c Improve error message when the proc-macro server unexpectedly exits 2024-07-01 14:30:21 +02:00
bors
94e5efdab1 Auto merge of #17495 - listochkin:pass-cargo-extra-args-for-debugger, r=Veykril
pass cargo extra args when debugging

fixes #17128
2024-07-01 10:34:09 +00:00
bors
29fbc2414d Auto merge of #17494 - harrysarson:harry/keep-braces, r=Veykril
do not normalize `use foo::{self}` to `use foo`

It changes behaviour and can cause collisions. E.g. for the following snippet

```rs
mod foo {

    pub mod bar {}

    pub const bar: i32 = 8;
}

// transforming the below to `use foo::bar;` causes the error:
//
//   the name `bar` is defined multiple times
use foo::bar::{self};

const bar: u32 = 99;

fn main() {
    let local_bar = bar;
}
```

we still normalize

```rs
use foo::bar;
use foo::bar::{self};
```

to `use foo::bar;` because this cannot cause collisions.

See: https://github.com/rust-lang/rust-analyzer/pull/17140#issuecomment-2079189725
2024-07-01 10:20:01 +00:00
bors
dffbad50c1 Auto merge of #17522 - Veykril:comptimes, r=Veykril
internal: Cut compiletimes slightly
2024-07-01 08:43:11 +00:00
Lukas Wirth
d40bc51e3d Bump rustc_pattern_analysis 2024-06-30 18:41:55 +02:00
Lukas Wirth
1653889bad Remove serde flag from indexmap dependency 2024-06-30 18:14:53 +02:00
bors
2cac9a5684 Auto merge of #17520 - Veykril:slim-proc-macro-api, r=Veykril
internal: Cleanup proc-macro-srv some more
2024-06-30 15:12:50 +00:00
Lukas Wirth
fefcb46c3f Arc proc-macro expander paths 2024-06-30 17:03:03 +02:00
Lukas Wirth
45362de42f Abstract proc-macro-srv protocol format 2024-06-30 16:56:30 +02:00
Lukas Wirth
b1518b262e Simplify 2024-06-30 16:43:22 +02:00
Lukas Wirth
58286ccbd1 Actual dummy server for the server cli 2024-06-30 16:34:06 +02:00
Lukas Wirth
f3b3eef221 Fix proc-macro-test build script 2024-06-30 16:26:39 +02:00
Lukas Wirth
4c6235948d Faster env snapshotting in proc-macro-srv 2024-06-30 16:10:20 +02:00
Lukas Wirth
ef4b97490f Move proc-macro-test test path fetching from include to env var 2024-06-30 15:37:00 +02:00
Lukas Wirth
d8a74a2b60 Rename proc-macro-srv::server to server_impl 2024-06-30 15:36:46 +02:00
Lukas Wirth
05c77898d9 Move proc-macro-srv RUSTC_VERSION fetching from include to env var 2024-06-30 15:28:31 +02:00
Lukas Wirth
f4c2ac456e Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
Lukas Wirth
8c526eefd3 Move interior mutability into ProcMacroSrvProcess 2024-06-30 15:22:39 +02:00
bors
64f7945d52 Auto merge of #17519 - Veykril:slim-proc-macro-api, r=Veykril
internal: Move dylib version stuff to proc-macro-srv

The client no longer reads the proc-macro versions, so this has no need to be in the api crate
2024-06-30 13:07:21 +00:00
Lukas Wirth
fd9dce7fb8 Move dylib version stuff to proc-macro-srv 2024-06-30 15:05:35 +02:00
bors
2e8b977a2d Auto merge of #17516 - kilpkonn:master, r=kilpkonn
Quality of life improvements to term search

Basically two things:
- Allow optionally disabling "borrow checking" restrictions on term search code assists. Sometimes it is better to get invalid suggestions and fix borrow checking issues later...
- Remove explicit generics in generated expressions. I find it quite rare that one writes `None::<T>` instead of `None`.
2024-06-30 12:41:22 +00:00
bors
ba01c0ab39 Auto merge of #17467 - winstxnhdw:bool-to-enum, r=Veykril
feat: add bool_to_enum assist for parameters

## Summary

This PR adds parameter support for `bool_to_enum` assists. Essentially, the assist can now transform this:

```rs
fn function($0foo: bool) {
    if foo {
        println!("foo");
    }
}
```

To this,

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

fn function(foo: Bool) {
    if foo == Bool::True {
        println!("foo");
    }
}
```

Thanks to `@/davidbarsky`  for the test skeleton (:

Closes #17400
2024-06-30 12:26:07 +00:00
Tavo Annus
585e4d6609 Do not explicit generics to generated expressions 2024-06-30 15:19:19 +03:00
bors
079ee28362 Auto merge of #17518 - Veykril:expr-scopes-mac, r=Veykril
fix: Fix expression scope calculation when within macro expansions
2024-06-30 12:11:12 +00:00
Lukas Wirth
eb72a9e2fd Simplify 2024-06-30 14:00:55 +02:00
Lukas Wirth
4453fd49cd Fix expression scope calculation when within macro expansions 2024-06-30 13:26:17 +02:00
Lukas Wirth
00fc75885f Simplify unresolved proc-macro handling 2024-06-30 13:26:13 +02:00
bors
acdfab645f Auto merge of #17513 - roife:fix-issue-17500, r=Veykril
fix: completions after async kw

fix #17500

### Changes

1. fix completions after async kw
2. fix completions for `async` kw in trait
2024-06-30 11:10:59 +00:00
roife
71bc01370c fix: completions after async kw 2024-06-29 22:23:54 +08:00
Tavo Annus
8fd7ae9759 Make borrow checking configurable for term search 2024-06-29 12:24:08 +03:00
Joel Daniel Rico
1e087a5557 Add landing/faq walkthroughs and commands for quick access 2024-06-28 11:13:12 -07:00
Shoyu Vanilla
4b7fb6a3db Use proper ImplTraits in insert_inference_vars_for_impl_trait 2024-06-27 23:51:33 +09:00
Shoyu Vanilla
2a2532687a Add a regression test for issue 17199 that causes stack overflow 2024-06-27 23:48:15 +09:00