Commit Graph

801 Commits

Author SHA1 Message Date
iDawer
a9ad7be748 Respect binding mode of a binding pattern for exhaustiveness check 2021-12-20 00:14:39 +05:00
iDawer
b17aefb83a internal: Normalize field type after substituting 2021-12-20 00:14:39 +05:00
iDawer
1280961b51 internal: sync match checking with rust-lang/rust f31622a50 2021-11-12 2021-12-20 00:10:01 +05:00
Dawer
deb05930ef internal: Sync match checking algorithm with rustc
Original version: rust-lang/rust  68b76a483 2021-10-01
2021-12-20 00:10:01 +05:00
Laurențiu Nicola
32b6f103a6 Bump chalk 2021-12-19 18:58:39 +02:00
Jonas Schievink
fcc76e93a0 Initial support for #[rustc_legacy_const_generics] 2021-12-17 18:45:56 +01:00
zhoufan
c3ad945d9b fixes broken tests 2021-12-14 15:57:58 +08:00
zhoufan
7b952cb1aa infer associated method in local scope 2021-12-14 15:34:57 +08:00
bors[bot]
0eb6039e4e
Merge #10987
10987: fix: respect inner attributes for Structs and Enums r=lnicola a=rainy-me

fix: #10980 (the allow/deny issue is not fully resolved though.)

Co-authored-by: rainy-me <github@yue.coffee>
2021-12-11 17:20:14 +00:00
rainy-me
a0c52794bd fix: lookup upwards for struct and enum 2021-12-12 01:23:27 +09:00
Lukas Wirth
1bbc255ec5 Remove some allocations 2021-12-10 20:01:24 +01:00
Lukas Wirth
c81aa68afe Don't show trait flyimports for impl trait and placeholders 2021-12-10 19:18:21 +01:00
Lukas Wirth
c469f8abcb internal: Shrink TraitImpls and InherentImpls HashMaps 2021-12-09 18:39:46 +01:00
Lukas Wirth
e1a236d65e Simplify 2021-12-09 18:28:10 +01:00
Lukas Wirth
f9c59d3752 Use known names instead of string literals 2021-12-09 18:13:15 +01:00
Jonas Schievink
c0a30ff21d Move synstructure hack out of ItemTree lowering 2021-12-08 15:44:52 +01:00
Jonas Schievink
b365b6119c Treat extern blocks as item containers 2021-12-07 17:31:26 +01:00
Laurențiu Nicola
3678cbd12e Bump tracing 2021-12-06 20:54:45 +02:00
Laurențiu Nicola
26aba38168 Bump chalk 2021-12-04 15:08:43 +02:00
Lukas Wirth
ec07bb98f8 fix: Omit generic defaults for types in hover messages 2021-11-22 18:27:03 +01:00
Alex Veber
24f816c481 fix: better Fn traits formatting 2021-11-21 02:39:22 +02:00
Lukas Wirth
69782f55de Move incorrect case diagnostic things into their module 2021-11-20 17:25:57 +01:00
Lukas Wirth
ceaec9d866 internal: Replace Vec with Box in hir Pat 2021-11-20 16:17:30 +01:00
Lukas Wirth
cc327774b7 internal: Replace Vec with Box in hir Expr 2021-11-20 16:00:45 +01:00
Jonas Schievink
9f4c26e780 Format Fn traits using parentheses 2021-11-19 19:58:00 +01:00
Lukas Wirth
91bbc55eed Check for derive attributes by item path, not derive identifier 2021-11-17 20:46:57 +01:00
bors[bot]
3b3063fb2d
Merge #10741
10741: internal: Flatten Definition::ModuleDef variant r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-10 23:19:44 +00:00
Lukas Wirth
7776aad166 internal: Flatten Definition::ModuleDef variant 2021-11-11 00:05:53 +01:00
bors[bot]
e7244e899f
Merge #10739
10739: internal: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-10 17:27:24 +00:00
Lukas Wirth
dea973089c Simplify 2021-11-10 18:26:18 +01:00
bors[bot]
b2bce38bb4
Merge #10729
10729: Fix: Lookup impls in local def maps r=jonas-schievink a=XFFXFF

fixes #10676 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-11-10 16:47:35 +00:00
Laurențiu Nicola
e98b072da7 Bump chalk 2021-11-09 20:05:04 +02:00
zhoufan
f00cd911bf lookup impls in local del maps 2021-11-09 18:14:02 +08:00
bors[bot]
7765c1a94f
Merge #10668
10668: fix: Fix for-loop expressions breaking with BlockExpr iterable r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10665
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-30 14:42:53 +00:00
Lukas Wirth
c93983e76f Fix for-loop expressions breaking with BlockExpr iterable 2021-10-30 16:37:32 +02:00
Laurențiu Nicola
d0a99ad54e Bump chalk 2021-10-29 23:26:59 +03:00
Laurențiu Nicola
8457ae34bd Set MSRV 2021-10-23 15:07:11 +03:00
Laurențiu Nicola
ca44b6892e Use array IntoIter 2021-10-22 09:23:29 +03:00
Lukas Wirth
1294bfce86 Migrate to edition 2021 2021-10-21 20:10:40 +02:00
bors[bot]
6aeeb4ef33
Merge #10603
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>
2021-10-21 10:39:26 +00:00
Lukas Wirth
ea2a2c52fc Don't resolve attributes to non attribute macros 2021-10-21 12:22:40 +02:00
bors[bot]
6877240fdf
Merge #10563
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>
2021-10-20 21:02:46 +00:00
bors[bot]
11326a6847
Merge #10387
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>
2021-10-20 20:54:36 +00:00
Laurențiu Nicola
24eca25d8a Make some functions non-generic 2021-10-20 20:20:17 +03:00
Andrzej Głuszak
98676efdc5 Semantic getter 2021-10-17 16:33:14 +02:00
Aramis Razzaghipour
dce5c640f8
Move IdxRange into la_arena 2021-10-15 13:03:28 +11:00
Aleksey Kladov
afacdd612d internal: update expect 2021-10-09 17:17:16 +03:00
Jonas Schievink
f8acae7895 Support let...else 2021-10-07 17:06:24 +02:00
crauzer
a4f08c117f Fix stdx::to_snake_case 2021-10-06 23:24:47 +02:00
bors[bot]
86c534f244
Merge #10440
10440: Fix Clippy warnings and replace some `if let`s with `match` r=Veykril a=arzg

I decided to try fixing a bunch of Clippy warnings. I am aware of this project’s opinion of Clippy (I have read both [rust-lang/clippy#5537](https://github.com/rust-lang/rust-clippy/issues/5537) and [rust-analyzer/rowan#57 (comment)](https://github.com/rust-analyzer/rowan/pull/57#discussion_r415676159)), so I totally understand if part of or the entirety of this PR is rejected. In particular, I can see how the semicolons and `if let` vs `match` commits provide comparatively little benefit when compared to the ensuing churn.

I tried to separate each kind of change into its own commit to make it easier to discard certain changes. I also only applied Clippy suggestions where I thought they provided a definite improvement to the code (apart from semicolons, which is IMO more of a formatting/consistency question than a linting question). In the end I accumulated a list of 28 Clippy lints I ignored entirely.

Sidenote: I should really have asked about this on Zulip before going through all 1,555 `if let`s in the codebase to decide which ones definitely look better as `match` :P

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-05 08:58:40 +00:00