Commit Graph

351 Commits

Author SHA1 Message Date
Lukas Wirth
0eb7b6c7b5 Don't show unused_variables fixes if the name comes from a macro definition 2024-04-17 12:05:35 +02:00
Wyatt Herkamp
701068daf2 Verify we are not in a macro attempt 2 2024-04-15 14:11:45 -04:00
Wyatt Herkamp
0faa2940c7 Use the text range for the name. Not the entire syntax in Unused Variable Diagnostic. 2024-04-15 10:46:21 -04:00
Lukas Wirth
1915980031 fix: Fix impl Trait<Self> causing stackoverflows 2024-04-15 15:41:20 +02:00
Lukas Wirth
0036762b9d Make use of ThinArc in RawAttrs 2024-03-21 11:49:09 +01:00
bors
4e54b4bd6c Auto merge of #16889 - Veykril:utf8-path, r=Veykril
internal: Enforce utf8 paths

Cargo already requires this, and I highly doubt r-a works with non-utf8 paths generally either. This just makes dealing with paths a lot easier.
2024-03-19 14:57:18 +00:00
bors
a2f73d3142 Auto merge of #16879 - Nadrieril:fuel, r=Veykril
Add fuel to match checking

Exhaustiveness checking is NP-hard hence can take extremely long to check some specific matches. This PR makes ehxaustiveness bail after a set number of steps. I chose a bound that takes ~100ms on my machine, which should be more than enough for normal matches.

I'd like someone with less recent hardware to run the test to see if that limit is low enough for them. Also curious if the r-a team thinks this is a good ballpark or if we should go lower/higher. I don't have much data on how complex real-life matches get, but we can definitely go lower than `500 000` steps.

The second commit is a drive-by soundness fix which doesn't matter much today but will matter once `min_exhaustive_patterns` is stabilized.

Fixes https://github.com/rust-lang/rust-analyzer/issues/9528 cc `@matklad`
2024-03-19 14:44:05 +00:00
Lukas Wirth
399dbc074b internal: Enforce utf8 paths 2024-03-19 15:39:00 +01:00
Nadrieril
08a5f1e52a Skip the test when testing locally 2024-03-19 15:08:57 +01:00
Lukas Wirth
b38d5394bb internal: Move grammar codegen into xtask 2024-03-19 10:57:53 +01:00
Nadrieril
040f37a99d Avoid hanging on complex matches 2024-03-18 21:21:52 +01:00
bors
b6d1887bc4 Auto merge of #16861 - Veykril:macro-diag-exceptions, r=Veykril
fix: Ignore some warnings if they originate from within macro expansions

These tend to be annoying noise as we can't handle `allow`s for them properly for the time being.
2024-03-17 20:41:40 +00:00
Lukas Wirth
bb541c38d3 fix: Ignore some warnings if they originate from within macro expansions 2024-03-17 21:30:56 +01:00
Matthias Krüger
2a8edaa14d remove redundant clone()s 2024-03-17 14:06:21 +01:00
Lukas Wirth
9ba4493918 internal: Improve rooted upmapping 2024-03-12 13:46:58 +01:00
Lukas Wirth
fdc527f096 fix: Fix method resolution snapshotting receiver_ty too early 2024-03-11 15:35:06 +01:00
Young-Flash
562f4a2688 test: update test for unused_variables 2024-03-11 19:36:53 +08:00
Young-Flash
77136575da feat: add fix for unused_variables 2024-03-11 19:36:53 +08:00
bors
a58f574816 Auto merge of #16762 - wyatt-herkamp:master, r=Veykril
Added QuickFix for unresolved field.

Adds an AssistKind::QuickFix for unresolved field.

Currently, Snippets are not available for Diagnostics. So the type defaults to the Unit type if the type is not able to be inferred.

https://github.com/rust-lang/rust-analyzer/assets/11785959/bd4c67bd-f8cb-4254-9a87-641ae80a7a28

Closes https://github.com/rust-lang/rust-analyzer/issues/4563
2024-03-11 09:31:22 +00:00
Laurențiu Nicola
cd2347e132 Skip match diagnostics for partially unknown types 2024-03-07 19:11:23 +02:00
Wyatt Herkamp
4f0bc1a314 Typo 2024-03-06 11:51:45 -05:00
Wyatt Herkamp
255ba692aa Added tests, added Union Support, and code cleanup 2024-03-06 10:55:47 -05:00
Wyatt Herkamp
6027eae51e Fix Tests + Fix Warnings 2024-03-05 08:34:52 -05:00
Wyatt Herkamp
b45cfe15b5 Added quickfix for unresolved field. 2024-03-05 08:07:21 -05:00
Lukas Wirth
8844640c6f fix: Put style lints behind disabled-by-default config 2024-03-05 11:43:23 +01:00
Lukas Wirth
76463eee48 Move lint definition generation into xtask/codegen 2024-03-04 17:14:14 +01:00
Lukas Wirth
0964374274 Move diagnostics docs generation into xtask/codegen 2024-03-04 17:14:14 +01:00
Lukas Wirth
6e802a0b56 minor: Mark remove_unnecessary_else as experimental 2024-03-04 16:35:33 +01:00
bors
a7e9f12bf7 Auto merge of #16748 - Veykril:on-demand-validation-err, r=Veykril
internal: Compute syntax validation errors on demand

The LRU cache causes us to re-parse trees quite often, yet we don't use the validation errors at all. With this we push calculating them off to the caller who is interested in them.
2024-03-04 11:19:16 +00:00
Lukas Wirth
c3c9f5ffe1 internal: Compute syntax validation errors on demand 2024-03-04 12:06:15 +01:00
bors
99a1b8f7a8 Auto merge of #16747 - Veykril:cleanup, r=Veykril
internal: Clean some stuff up

Just a bunch of small refactorings, mainly from browsing through `hir-def`
2024-03-04 10:30:17 +00:00
Lukas Wirth
4303e741de Cleanup 2024-03-04 11:10:06 +01:00
Vincent Esche
6112ddfabb Add prefix file_ to Semantics's to_module_defs()/to_module_def() methods 2024-02-28 10:27:28 +01:00
bors
1d3558bfe1 Auto merge of #16684 - Veykril:synthetic-fmt-args, r=Veykril
fix: Don't panic on synthetic syntax in inference diagnostics

Temporary fix for https://github.com/rust-lang/rust-analyzer/issues/16682

We ought to rethink how we attach diagnostics to things, as IDs don't work for `format_args` like that!
2024-02-26 16:47:57 +00:00
Lukas Wirth
3856648b52 fix: Don't panic on synthetic syntax in inference diagnostics 2024-02-26 17:46:03 +01:00
Young-Flash
0978d165f3 add test case 2024-02-23 21:05:55 +08:00
Lukas Wirth
16b15a203e internal: Attempt to add a timeout to rustc-tests 2024-02-20 18:04:53 +01:00
Lukas Wirth
1e448f84c3 Clippy 2024-02-19 16:26:22 +01:00
Rose Hudson
a492d9d164 feat: add unresolved-ident diagnostic 2024-02-19 14:12:18 +01:00
Rose Hudson
d818b531c9 internal: make check_diagnostics_with_disabled more ergonomic 2024-02-19 14:12:18 +01:00
davidsemakula
7dfeb2cdcc refactor "unnecessary else" diagnostic test 2024-02-19 15:24:45 +03:00
davidsemakula
ff70310086 fix: only emit "unnecessary else" diagnostic for expr stmts 2024-02-19 15:24:45 +03:00
Shoyu Vanilla
1205853c36 Apply indent fix in #16575 2024-02-19 15:24:45 +03:00
Shoyu Vanilla
8f6e2127c3 Fix the remove unnecessary else action to preserve block tail expr 2024-02-19 15:24:45 +03:00
Shoyu Vanilla
21f4ff0351 Check for let expr ancestors instead of tail expr 2024-02-19 15:24:45 +03:00
Shoyu Vanilla
d14b22863b Handle cases for else if 2024-02-19 15:19:27 +03:00
Shoyu Vanilla
e9c80a9c25 fix: False positive diagnostic for necessary else 2024-02-19 15:19:27 +03:00
Rose Hudson
5390e4ce9b feat: add non-exhaustive-let diagnostic 2024-02-19 12:36:30 +01:00
Lukas Wirth
ead369117a CrateOrigin::Local means local to the project workspace, not cargo workspace 2024-02-16 16:28:17 +01:00
davidsemakula
9ae0f924dd fix "needless return" for trailing item declarations 2024-02-15 20:07:58 +03:00