Commit Graph

200 Commits

Author SHA1 Message Date
hkalbasi
36c9d5ce17 Fix pattern type mismatch in tuples 2023-05-04 16:03:36 +03:30
hkalbasi
3a3c3630a2 fix break-outside-of-loop false positive in try block 2023-05-02 03:11:56 +03:30
Aleksey Kladov
f3de9d8f54 fix: don't wavy-underline iterator chains 2023-04-29 17:31:53 +01:00
bors
8f06f995c5 Auto merge of #14644 - matklad:matklad/diag-adj, r=lnicola
feat: don't wavy-underline the whole for loop
2023-04-24 10:38:27 +00:00
Aleksey Kladov
774575106c feat: don't wavy-underline the whole for loop 2023-04-24 11:31:52 +01:00
hkalbasi
01c1b3dc71 Fix panic in const eval and parameter destructing 2023-04-24 00:49:57 +03:30
hkalbasi
0c621065fb Fix need-mut large span in closures and a false positive 2023-04-21 02:15:19 +03:30
bors
2400b36a2e Auto merge of #14577 - jsoref:spelling, r=lnicola
Spelling

This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling).

The misspellings have been reported at https://github.com/jsoref/rust-analyzer/actions/runs/4699991040#summary-12751355796

The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-analyzer/actions/runs/4699991284#summary-12751356293

closes #14567
2023-04-19 14:05:40 +00:00
Josh Soref
bc7d84c3ce Spelling
* a rule
* access
* after
* amount
* annotations
* assignment
* assist
* associated
* attribute
* borrowed
* built-in type
* clarification
* command
* const
* constructor
* corresponding
* counterparts
* curlies
* dependencies
* deterministic
* diagnostic
* duplicates
* edge
* edited
* efficient
* elsewhere
* execution
* expression
* extensions
* extracted
* fill
* github
* helper
* heuristic
* incomplete
* indent end
* inlay
* invocation
* lifetime
* looking
* maybe
* move
* mutability
* mutable
* necessarily
* necessary
* negative
* nonexistent
* occurred
* offsets
* offsetted
* overridden
* parameters
* params
* params_and_where_preds_in_scope
* paredit
* parent
* parentheses
* prepended if
* punctuation
* receive
* receiver
* referring
* repeated
* representing
* semantically
* separately
* shouldnot
* siblings
* similar
* something's
* statement
* struct
* structure
* surprise
* the
* this
* transparent
* unimplemented
* unnamed
* unnecessary
* unneeded
* unreachable
* unterminated
* utilities
* variant
* variants
* visibility
* work around (v)
* workaround

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-19 09:45:55 -04:00
hkalbasi
f05f7ab082 Add minicore smoke test 2023-04-18 17:38:38 +03:30
Lukas Wirth
a2a3fecae3 Option begone part 2 2023-04-16 19:20:48 +02:00
Lukas Wirth
0f4ffaa5af Fix duplicate eager expansion errors 2023-04-16 19:20:35 +02:00
Lukas Wirth
d1632c2727 Report syntax errors from item level macro expansions 2023-04-16 17:22:06 +02:00
Lukas Wirth
a5558cdfe5 internal: Report macro definition errors on the definition 2023-04-16 14:15:59 +02:00
hkalbasi
7cb4318331 Fix explicit deref problems in closure capture 2023-04-14 15:32:40 +03:30
Ryo Yoshida
ac03de773f
Add flag to disallow opaque types for DisplayTarget::SourceCode 2023-04-12 19:03:48 +09:00
hkalbasi
59b6f2d9f2 Compute closure captures 2023-04-10 23:04:34 +03:30
Lukas Wirth
98a673c4a8 fix: Fix project linking popup appearing for modules that can be linked to a crate 2023-04-09 10:17:58 +02:00
Lukas Wirth
fbb1bd5880 Re-enable controlflow outside loop diagnostic 2023-04-06 15:37:53 +02:00
Lukas Wirth
0e7117900c internal: Resolve labels in body lowering 2023-04-06 14:21:20 +02:00
hkalbasi
d7fe4e2fa8 lower adjusts in simple index except the last one 2023-04-01 16:49:32 +03:30
Lukas Wirth
f1f64e92d7 Fix mutability_error::overloaded_index test 2023-03-29 18:07:25 +02:00
bors
7a98e24777 Auto merge of #14431 - Veykril:simplify, r=Veykril
minor: Simplify
2023-03-29 07:28:42 +00:00
Lukas Wirth
8ea1afce28 Simplify 2023-03-28 16:32:26 +02:00
hkalbasi
d5c7ec499a fix stack overflow in is_ty_uninhabited_from 2023-03-28 15:45:35 +03:30
bors
5bba438c9c Auto merge of #14366 - Veykril:linked-proj, r=Veykril
feat: Pop a notification prompting the user to add a Cargo.toml of unlinked file to the linkedProjects

cc https://github.com/rust-lang/rust-analyzer/issues/13226 https://github.com/rust-lang/rust-analyzer/issues/9661
2023-03-28 07:05:43 +00:00
Lukas Wirth
ee02213e65 Handle proc macro fetching via OpQueue 2023-03-26 09:33:41 +02:00
hkalbasi
9ad83deecc Support overloaded index MIR lowering 2023-03-17 19:10:25 +03:30
hkalbasi
eb4939e217 Support overloaded deref MIR lowering 2023-03-17 14:02:55 +03:30
hkalbasi
a063f000ff Support function pointer MIR lowering 2023-03-17 13:08:35 +03:30
Lukas Wirth
66636939a6 feat: Pop a notification prompting the user to add a Cargo.toml of unlinked file to the linkedProjects 2023-03-16 16:26:19 +01:00
XFFXFF
0c935732bc do not offer fixit for macro expansions and refactor the code 2023-03-15 09:12:40 +08:00
XFFXFF
bf0322cd0c pick the best ancestor expr of unsafe expr to add unsafe block. Thanks! @Veykril 2023-03-15 09:07:11 +08:00
XFFXFF
82780d8caf feat: add an autofix for inserting an unsafe block to missing unsafe diagnostic 2023-03-15 09:07:11 +08:00
Lukas Wirth
f34b2469bd lint incoherent inherent impls 2023-03-14 19:20:44 +01:00
Lukas Wirth
1a9fbf0a6d fix: Fix visibility resolution not respecting parent blocks 2023-03-14 13:42:08 +01:00
bors
6a98e961f8 Auto merge of #14340 - Veykril:expand, r=lnicola
internal: Rename AstDatabase to ExpandDatabase
2023-03-14 09:37:54 +00:00
hkalbasi
d7da9e64d1 Add storage dead for let bindings without initializer 2023-03-14 12:15:16 +03:30
Lukas Wirth
9fb9ee3b6a internal: Rename AstDatabase to ExpandDatabase 2023-03-13 16:35:41 +01:00
bors
70e10deee8 Auto merge of #14326 - iDawer:refactor, r=Veykril
internal: Rename `hir::diagnostics::MissingMatchArms.match_expr` field

`hir::diagnostics::MissingMatchArms.match_expr` had confusing name: it is pointing to scrutinee expression. Renamed to `scrutinee_expr` and used better fitting type for it.

Also small refactorings/cleanup.
2023-03-11 07:36:00 +00:00
iDawer
5e8c586f3b Refactor hir::diagnostics::MissingMatchArms fields, better naming 2023-03-10 18:22:32 +05:00
hkalbasi
a980b562a7 Fix stack overflow when derefrencing &! 2023-03-10 13:44:34 +03:30
hkalbasi
8593132a43 fix block with no termination in or patterns 2023-03-09 22:32:12 +03:30
bors
ecc32c2f85 Auto merge of #14271 - Veykril:ty-diag-err, r=Veykril
Don't trigger unresolved method/field diagnostics on types containing errors
2023-03-07 14:25:20 +00:00
Lukas Wirth
d45708fabe Don't trigger unresolved method/field diagnostics on types containing errors 2023-03-07 15:24:43 +01:00
bors
44ff3c407a Auto merge of #14232 - HKalbasi:mir, r=Veykril
MIR episode 2

This PR adds:
1. `need-mut` and `unused-mut` diagnostics
2. `View mir` command which shows MIR for the body under cursor, useful for debugging
3. MIR lowering for or-patterns and for-loops
2023-03-07 09:49:49 +00:00
hkalbasi
bcd7ecb242 Add profiling to mir lower and borrowck query 2023-03-07 12:42:52 +03:30
Lukas Wirth
34a3187ee8 internal: Mark unresolved field, unresolved method and expected function diagnostics experimental 2023-03-06 22:24:38 +01:00
hkalbasi
2cce9dc3e9 Make unused_mut diagnostic experimental 2023-03-06 21:09:09 +03:30
hkalbasi
af90ec8096 Partially support "overloaded deref" MIR lowering 2023-03-06 21:09:09 +03:30
hkalbasi
bf0f99f15d Fix overloaded deref unused mut false positive 2023-03-06 21:09:09 +03:30
hkalbasi
6377d50bd1 Support "for loop" MIR lowering 2023-03-06 21:09:09 +03:30
hkalbasi
ac04bfd7a7 Add View Mir command and fix some bugs 2023-03-06 21:09:09 +03:30
hkalbasi
a25710b0c0 Add need-mut and unused-mut diagnostics 2023-03-06 21:09:08 +03:30
Lukas Wirth
29150c2315 Disable pattern type mismatches again 2023-03-03 22:41:41 +01:00
Lukas Wirth
e7485a0416 Diagnose unresolved method calls 2023-03-03 20:43:13 +01:00
Lukas Wirth
78b2dd813a Diagnose unresolved field accesses 2023-03-03 20:43:10 +01:00
Lukas Wirth
3c7a0aa00e Diagnose call expression on non-callable things 2023-03-03 20:43:05 +01:00
Lukas Wirth
41f234df09 Diagnose value breaks in incorrect breakables 2023-03-03 17:28:57 +01:00
bors
c229a836e8 Auto merge of #14222 - Veykril:pat-mismatch-diags, r=Veykril
Show pattern mismatch diagnostics
2023-03-03 10:33:54 +00:00
Lukas Wirth
522823f610 Fix text fixtures of missing_match_arms diagnostics 2023-03-03 11:13:06 +01:00
Lukas Wirth
44e2c6ea92 Don't emit two type mismatches for literal pattern mismatches 2023-03-03 10:42:49 +01:00
Lukas Wirth
fc2b395e00 Show pattern mismatch diagnostics 2023-03-03 10:41:44 +01:00
Ryo Yoshida
943de55214
Fix typo 2023-03-03 01:12:39 +09:00
Ryo Yoshida
83e24fec98
Fix associated item visibility in block-local impls 2023-02-19 23:55:55 +09:00
bors
fa874627f0 Auto merge of #13969 - Veykril:workspace.dependencies, r=Veykril
Use workspace.dependencies to declare local dependencies
2023-01-17 10:29:27 +00:00
Lukas Wirth
bed4db3c62 Use workspace.dependencies to declare local dependencies 2023-01-17 10:52:26 +01:00
Lukas Wirth
e4858fe480 Specify authors, edition and license via workspace.package 2023-01-16 16:44:00 +01:00
Lukas Wirth
679df2adf1 Specify rust-version via workspace.package 2023-01-16 16:33:01 +01:00
Lukas Wirth
14777ce751 fix indentation of unlinked_file quickfix 2023-01-12 11:24:44 +01:00
Lukas Wirth
5214a98d9c Simplify 2023-01-11 23:04:35 +01:00
Lukas Wirth
1ce3e820dc feat: Make unlinked_file diagnostic quickfixes work for inline modules 2023-01-11 22:39:05 +01:00
Daniel Eades
ac3844a0bb a number of code simplifications 2023-01-10 18:48:51 +00:00
Daniel Eades
ed128872eb remove needless borrows 2023-01-02 14:52:32 +00:00
Lukas Wirth
eee7de0225 Diagnose private assoc item accesses 2023-01-01 13:24:48 +01:00
Lukas Wirth
e3d144d17f Diagnose private field accesses 2022-12-31 14:20:59 +01:00
bors
0d76b94c90 Auto merge of #13866 - Nilstrieb:rustc_safe_intrinsic, r=Veykril
Use `rustc_safe_intrinsic` attribute to check for intrinsic safety

Instead of maintaining a list that is poorly kept in sync we can just use the attribute.

This will make new RA versions unusable with old toolchains that don't have the attribute yet. Should we keep maintaining the list as a fallback or just don't care?
2022-12-30 22:14:31 +00:00
Nilstrieb
72afcf2cad Use rustc_safe_intrinsic attribute to check for intrinsic safety
Instead of maintaining a list that is poorly kept in sync we can just
use the attribute.
2022-12-30 20:29:37 +01:00
Maybe Waffle
ef303f224f Actually test closures in closures_are_borders 2022-12-28 20:56:58 +00:00
Maybe Waffle
797da9e8da Actually test async{} blocks in async_blocks_are_borders 2022-12-28 20:56:58 +00:00
Maybe Waffle
eecab99dec Allow break and co to go through try{} blocks 2022-12-28 20:56:58 +00:00
Yuri Astrakhan
e16c76e3c3 Inline all format arguments where possible
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.

The change was automatically created with, so there are far less change
of an accidental typo.

```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Yuri Astrakhan
e341e996f7 Clippy-fix explicit auto-deref
Seems like these can be safely fixed. With one, I was particularly
surprised -- `Some(pats) => &**pats,` in body.rs?

```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```
2022-12-23 02:52:14 -05:00
Yuri Astrakhan
1d59c7b667 Remove non-needed clones
I am not certain if this will improve performance,
but it seems having a .clone() without any need should be removed.

This was done with clippy, and manually reviewed:

```
cargo clippy --fix -- -A clippy::all -D clippy::redundant_clone
```
2022-12-23 02:20:03 -05:00
Lukas Wirth
dc8254c6ab fix: Fix nested macro diagnostics pointing at macro expansion files 2022-11-19 10:32:32 +01:00
Ryo Yoshida
19306c070d
Fix tests that depended on loose visibility restriction 2022-11-11 20:31:46 +09:00
Lukas Wirth
ffd7bf8bf9 Bump Cargo rust-version fields to latest stable 2022-11-07 12:59:51 +01:00
Lukas Wirth
8047512dca
Revert "feat: Diagnose some incorrect usages of the question mark operator" 2022-10-18 14:18:59 +02:00
Lukas Wirth
381366f1dd Diagnose incorrect usages of the question mark operator 2022-10-16 12:58:24 +02:00
Laurențiu Nicola
cbce0cda08 Bump anyhow, arbitrary, itertools, semver, serde 2022-10-15 12:52:34 +03:00
unexge
b21bf25a07 Collect diagnostics in queries instead of nameres 2022-09-26 19:06:29 +01:00
unexge
89107d5469 Emit unconfigured code diagnostics for fields 2022-09-26 19:04:57 +01:00
Mathew Horner
a65ca20210 Fix tests by using primitive rather than String. 2022-09-16 16:56:19 -05:00
Mathew Horner
e7abf34c19 Fix add reference action on macros. 2022-09-15 20:25:29 -05:00
Lukas Wirth
a8ecaa1979 Restructure find_path into a separate functions for modules and non-module items
Also renames `prefer_core` imports config to `prefer_no_std` and changes the behavior of no_std path searching by preferring `core` paths `over` alloc
2022-09-13 15:15:27 +02:00
Lukas Wirth
7d19971666 Add config to unconditionally prefer core imports over std
Fixes https://github.com/rust-lang/rust-analyzer/issues/12979
2022-09-09 20:04:56 +02:00
bors
4f8153e4a5 Auto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril
feat: Implement `feature(exhaustive_patterns)` from unstable Rust

Closes #12753

Recognize Rust's unstable `#![feature(exhaustive_patterns)]` (RFC 1872). Allow omitting visibly uninhabited variants from `match` expressions when the feature is on.

This adjusts match checking to the current implementation of the postponed RFC 1872 in rustc.
2022-09-02 12:32:36 +00:00
Lukas Wirth
8110119fef Properly handle break resolution inside non-breakable expressions 2022-09-01 14:54:47 +02:00
Lukas Wirth
1e66a5a8ce Diagnose incorrect continue expressions 2022-09-01 14:41:38 +02:00
iDawer
1a580a3396 Implement unstable RFC 1872 exhaustive_patterns 2022-08-31 20:17:54 +05:00