davidsemakula
6d2d6323ac
incorrect case diagnostics for trait assoc functions and consts
2024-02-02 17:07:08 +03:00
davidsemakula
5fe3b75677
incorrect case diagnostics for trait name
2024-02-02 17:07:08 +03:00
bors
8f6a72871e
Auto merge of #16469 - Young-Flash:ci_typos, r=lnicola
...
internal: add typos check CI (part 2)
follow up https://github.com/rust-lang/rust-analyzer/pull/16448
2024-02-02 12:02:48 +00:00
Young-Flash
ba2910a3a7
minor: correct some typos
2024-02-02 18:22:54 +08:00
Laurențiu Nicola
4f09335063
Merge remote-tracking branch 'upstream/master' into sync-from-rust
2024-02-02 08:40:28 +02:00
David Barsky
f9bef39d48
internal: add some more tracing
spans inside of hir-ty
2024-02-01 16:10:32 -05:00
David Barsky
0fd770613b
internal: Move TyBuilder::subst_for_def
into a block
2024-02-01 16:06:05 -05:00
Lukas Wirth
9e8a0fae0c
Lint debug prints and disallowed types with clippy
2024-02-01 17:57:27 +01:00
bors
850ba2fb63
Auto merge of #16451 - Urhengulas:satisfy-clippy, r=Veykril
...
internal: Work through temporarily allowed clippy lints, part 2
Another follow-up to https://github.com/rust-lang/rust-analyzer/pull/16401 .
2024-02-01 14:23:18 +00:00
bors
42cb1a2bd7
Auto merge of #16465 - Veykril:eprintln, r=Veykril
...
minor: Remove `stdx::eprintln` overwrite
2024-01-31 21:07:50 +00:00
Lukas Wirth
23f4b7f45f
Remove stdx::eprintln overwrite
2024-01-31 22:06:05 +01:00
clubby789
a1fdb876c3
Remove abi_amdgpu_kernel
references
2024-01-31 19:06:10 +00:00
bors
039681112f
Auto merge of #16456 - davidbarsky:david/tracing-followups, r=Veykril
...
internal: `tracing` improvements and followups
Hi folks! Building on https://github.com/rust-lang/rust-analyzer/pull/16394 , I've got a few small tweaks:
- Removed the accidental `mod.rs` usage that I introduced.
- Removed a panic in `pat_analysis.rs`.
- Recorded the event kind in `handle_event` to better distinguish what _kind_ of event is being handled.
- Did a small refactor of `hprof` to have somewhat more linear control flow, and more importantly, write the recorded fields to the output.
The end result is the following:
<img width="1530" alt="A screenshot of Visual Studio Code on a Mac. `hprof.rs` is open, with " src="https://github.com/rust-lang/rust-analyzer/assets/2067774/bd11dde5-b2da-4774-bc38-bcb4772d1192 ">
2024-01-31 18:29:51 +00:00
David Barsky
44494e235a
internal: teach hprof to record tracing
fields
2024-01-31 13:15:47 -05:00
Johann Hemmann
df2c7a6e4e
cargo clippy --fix
2024-01-31 19:06:36 +01:00
Johann Hemmann
771c6c9271
format_collect
2024-01-31 19:06:36 +01:00
Johann Hemmann
d37f4e0d21
new_without_default
2024-01-31 19:06:36 +01:00
Johann Hemmann
e7e09e7750
large_enum_variant
2024-01-31 19:06:35 +01:00
Johann Hemmann
04ccef80cb
field_reassign_with_default
2024-01-31 19:06:18 +01:00
Johann Hemmann
dd9f27b8d3
borrow_deref_ref
2024-01-31 19:06:18 +01:00
Johann Hemmann
c4688343de
derivable_impls
2024-01-31 19:06:18 +01:00
Johann Hemmann
0adb4d1685
wildcard_in_or_patterns
2024-01-31 19:06:18 +01:00
Johann Hemmann
b176cf2478
useless_format
2024-01-31 19:06:18 +01:00
Johann Hemmann
b73ee2f50d
useless_conversion
2024-01-31 19:06:18 +01:00
Johann Hemmann
e7d0deac53
unnecessary_mut_passed
2024-01-31 19:06:18 +01:00
Johann Hemmann
f191b80799
Refactor
2024-01-31 19:06:18 +01:00
Johann Hemmann
c4302eaa56
unnecessary_lazy_evaluations
2024-01-31 19:06:18 +01:00
Johann Hemmann
f15ee8a380
unnecessary_filter_map
2024-01-31 19:06:18 +01:00
Johann Hemmann
de6f9561f2
unnecessary_cast
2024-01-31 19:06:18 +01:00
Johann Hemmann
daa20725c5
toplevel_ref_arg
2024-01-31 19:06:18 +01:00
Johann Hemmann
386d438e17
skip_while_next
2024-01-31 19:06:18 +01:00
David Barsky
579e98c4c5
internal: record Event kind in handle_event
2024-01-31 13:00:40 -05:00
David Barsky
251b14f2c5
internal: don't panic in debug_pat
2024-01-31 13:00:30 -05:00
bors
355c9444e1
Auto merge of #16448 - Young-Flash:typos, r=lnicola
...
minor: correct typos
I use [crate-ci/typos](https://github.com/crate-ci/typos ) to check typos in codebase, if it's ok with you, I'd like to add a typo check CI using [typos](https://github.com/crate-ci/typos ) (with Apache-2.0, MIT licenses).
BTW, we can add a [_typos.toml](https://github.com/crate-ci/typos/blob/master/docs/reference.md ) as white list for some intentional typos
2024-01-31 13:29:55 +00:00
Young-Flash
62ff8f33d4
minor: correct close
to closure
2024-01-31 21:26:30 +08:00
bors
9d837a622d
Auto merge of #16445 - lnicola:bump-scip, r=lnicola
...
internal: Bump scip
Fixes #16440
2024-01-31 09:27:01 +00:00
bors
2661c272c9
Auto merge of #16461 - Veykril:expansion-info, r=Veykril
...
internal: Remove unnecessary usages of ExpansionInfo
And some follow up simplifications to https://github.com/rust-lang/rust-analyzer/pull/16439
2024-01-31 08:58:55 +00:00
Lukas Wirth
d252247ab7
internal: Remove unnecessary usages of ExpansionInfo
2024-01-31 09:57:17 +01:00
bors
e48bc04eaf
Auto merge of #16459 - Veykril:diagnostics, r=Veykril
...
internal: Use improved adjusted_display_range for all diagnostics
2024-01-31 08:17:53 +00:00
Lukas Wirth
604479c373
internal: Use improved adjusted_display_range for all diagnostics
2024-01-31 09:16:30 +01:00
bors
e4146af294
Auto merge of #16441 - Young-Flash:exclude_tests_refs, r=Veykril
...
feat: enable excluding refs search results in test
## Change
Here I introduce a new `ReferenceCategory::Test` type to indicate whether the function where this reference is located is marked as `#[test]`, and expose an config item (`rust-analyzer.references.excludeTests`) to client.
I also changed the signature of `ReferenceCategory::new`, adding a `sema: &Semantics<'_, RootDatabase>` param to do some hir analysis. Hope the current implementation is good to go.
## Demo
`"rust-analyzer.references.excludeTests": false`
![include](https://github.com/rust-lang/rust-analyzer/assets/71162630/9f1176d4-7b41-4f49-ac79-55d25a42d5d1 )
`"rust-analyzer.references.excludeTests": true`
![exclude](https://github.com/rust-lang/rust-analyzer/assets/71162630/2938b44b-9e5b-48de-a049-453f5bbc09d0 )
close https://github.com/rust-lang/rust-analyzer/issues/14530
2024-01-31 07:53:28 +00:00
David Barsky
17d2e8d910
internal: remove tracing/mod.rs
2024-01-30 13:37:27 -05:00
David Barsky
e1ea7c8844
internal: switch to tracing
from log
...
This commit also adds `tracing` to NotificationDispatcher/RequestDispatcher,
bumps `rust-analyzer-salsa` to 0.17.0-pre.6, `always-assert` to 0.2, and
removes the homegrown `hprof` implementation in favor of a vendored
tracing-span-tree.
2024-01-30 12:27:31 -05:00
bors
63123ab408
Auto merge of #16417 - davidsemakula:normalize-use-trees, r=Veykril
...
feat: "Normalize import" assist and utilities for normalizing use trees
- Add import/use tree normalization utilities
- Add "normalize import" assist
- Update "merge imports" assist to always apply to the covering use item except for nested use tree selections
- Update "merge imports" assist to avoid adding unnecessary braces when merging nested use tree selections
See [this discussion](https://github.com/rust-lang/rust-analyzer/pull/16372#discussion_r1457244321 ) for the motivation for the new "normalize import" assist and changes to the "merge imports" assist.
2024-01-30 14:55:08 +00:00
Johann Hemmann
43b1ae0446
cargo clippy --fix
2024-01-30 14:50:21 +01:00
Johann Hemmann
75a42f1a09
collapsible_if
2024-01-30 14:44:44 +01:00
Young-Flash
db9fd370ee
minor: correct typos
2024-01-30 21:43:43 +08:00
davidsemakula
dba3fc4425
style: remove unnecessary macro
2024-01-30 16:15:15 +03:00
bors
11b401d0b4
Auto merge of #16447 - Veykril:mir-errors, r=Veykril
...
intenral: Cleanup error variants in MIR code a bit
2024-01-30 11:38:41 +00:00
bors
22b6f9679d
Auto merge of #16439 - wasd96040501:feat/gotodef3, r=Veykril
...
feat: Support for GOTO def from *inside* files included with include! macro
close #14937
Try to implement goto def from *inside* files included with include! macro.
This implementation has two limitations:
1. Only **one** file which calls include! will be tracked. (I think multiple file be included is a rare case and we may let it go for now)
2. Mapping token from included file to macro call file (semantics.rs:646~658) works fine but I am not sure is this the correct way to implement.
2024-01-30 11:27:18 +00:00
Lukas Wirth
5860763f18
Cleanup error variants in MIR code slightly
2024-01-30 09:53:39 +01:00
Laurențiu Nicola
20c01672a8
Bump scip
2024-01-30 08:43:17 +02:00
Young-Flash
2b71acac4f
test: add full path ref exclude test case
2024-01-29 18:47:58 +08:00
Young-Flash
6181102567
fix: use Semantics to judge whether a func is marked as #[test]
2024-01-29 18:42:41 +08:00
Laurențiu Nicola
f43cea0878
Merge commit '7219414e81810fd4d967136c4a0650523892c157' into sync-from-ra
2024-01-28 15:56:54 +02:00
Young-Flash
1bd21e98c0
test: add test for excluding refs
2024-01-28 18:39:42 +08:00
Young-Flash
6f303f49fe
feat: enable excluding refs search results in test
2024-01-28 18:28:13 +08:00
davidsemakula
84e13145ff
add more tests for normalize import assist
2024-01-28 11:55:01 +03:00
davidsemakula
fc00602723
merge imports assist avoids adding unnecessary braces when merging nested use tree selections
2024-01-28 11:55:01 +03:00
davidsemakula
b241593f36
merge imports assist always applies to covering use item except for nested use tree selections
2024-01-28 11:55:01 +03:00
davidsemakula
a8a18f3ccf
add normalize import assist
2024-01-28 11:55:01 +03:00
davidsemakula
81d713ea9f
remove ordered insert logic from recursive merge function
2024-01-28 11:55:01 +03:00
davidsemakula
8fab92feb2
normalize use trees when merging imports
2024-01-28 11:55:01 +03:00
YangzeLuo
b22e772cab
feat: Support for GOTO def from *inside* files included with include! macro
2024-01-27 23:36:01 +08:00
Alain Siegrist
7ec32d091a
Remove letelse control flow snippets
2024-01-27 14:35:22 +01:00
Alain Siegrist
51d57b9bb6
Make return a snippet
2024-01-27 14:35:22 +01:00
Alain Siegrist
57934ac47a
Add postfix completion for let else
2024-01-27 14:35:22 +01:00
davidsemakula
da798bccf7
make ast::UseTree::wrap_in_tree_list
more robust
2024-01-27 14:22:16 +03:00
bors
7219414e81
Auto merge of #16427 - Young-Flash:fix_no_such_field_diagnostics, r=Veykril
...
fix: filter out cfg disabled filed when lowering `RecordPat`
we should filter out field with disabled cfg when lowering ast `RecordPat` to hir.
close https://github.com/rust-lang/rust-analyzer/issues/16169
2024-01-27 10:52:36 +00:00
bors
27c3ed9de8
Auto merge of #16434 - Veykril:things, r=Veykril
...
internal: Restructure and cleanup hir-expand a bit
2024-01-27 10:16:35 +00:00
Lukas Wirth
8a5829cf28
Re-order mod declarations
2024-01-27 11:02:34 +01:00
Kirill Bulatov
ad5e2cfa3b
Do not return code lens data after resolving
2024-01-27 02:03:15 +02:00
Lukas Wirth
6cf7b5f8d7
Don't parse intra doc links as syntax trees
2024-01-26 20:00:47 +01:00
bors
596e5c77cf
Auto merge of #16431 - Ar4ys:fix-E0107-error-range-in-proc-macro, r=Veykril
...
Replaced adjusted_display_range with adjusted_display_range_new in mismatched_arg_count
For detailed description - see related issue.
Fixes : #16407
2024-01-26 18:53:03 +00:00
Lukas Wirth
5a343415e8
Add some size assertions
2024-01-26 19:28:39 +01:00
Lukas Wirth
d8ef6c24cc
Cleanup convert_path
2024-01-26 19:28:39 +01:00
Lukas Wirth
880baa9e56
Shuffle hir-expand things around
2024-01-26 19:28:39 +01:00
Lukas Wirth
e320004dad
Remove tt -> ast -> tt round trips in attrs lowering
2024-01-26 19:28:39 +01:00
bors
f09020567e
Auto merge of #16415 - Waqar144:work/make-try-to-nav-pub, r=Veykril
...
internal: Make TryToNav trait public
Currently there is no proper way to get a target FileRange for a given Definition.
2024-01-26 07:48:37 +00:00
Ar4ys
8f05e7ce55
Replaced adjusted_display_range with it's new version in mismatched_arg_count
2024-01-25 20:15:46 +01:00
Young-Flash
1374bc8c93
test: ensure no_such_field
diagnostic don't work for field with disabled cfg
2024-01-25 19:30:04 +08:00
Young-Flash
4505f03fbf
fix: filter out cfg disabled filed when lowering RecordPat
2024-01-25 19:27:37 +08:00
Laurențiu Nicola
b1b6e0c41a
Reapply "Detect NulInCStr
error earlier."
...
This reverts commit 0ea056552a
.
2024-01-25 06:40:07 +02:00
Nicholas Nethercote
858f4aca6c
Rename the unescaping functions.
...
`unescape_literal` becomes `unescape_unicode`, and `unescape_c_string`
becomes `unescape_mixed`. Because rfc3349 will mean that C string
literals will no longer be the only mixed utf8 literals.
2024-01-25 12:28:11 +11:00
Nicholas Nethercote
56514076ac
Rework CStrUnit
.
...
- Rename it as `MixedUnit`, because it will soon be used in more than
just C string literals.
- Change the `Byte` variant to `HighByte` and use it only for
`\x80`..`\xff` cases. This fixes the old inexactness where ASCII chars
could be encoded with either `Byte` or `Char`.
- Add useful comments.
- Remove `is_ascii`, in favour of `u8::is_ascii`.
2024-01-25 12:28:11 +11:00
Nicholas Nethercote
85d56eeb63
Fix copy/paste error.
...
The `CString` handling code is erroneously identical to the `ByteString`
handling code.
2024-01-25 12:26:25 +11:00
dfireBird
e0446a0eb5
implement assist for let stmt with TryEnum type to guarded return
2024-01-25 00:13:16 +05:30
Nadrieril
2370b70f25
Replace local copy of exhaustiveness checking with upstream librarified version
2024-01-23 15:54:00 +01:00
Waqar Ahmed
231f730e87
internal: Make TryToNav trait public
...
Currently there is no proper way to get a target FileRange for a given
Definition.
2024-01-22 15:20:58 +05:00
Laurențiu Nicola
56077149df
Format code
2024-01-21 21:16:53 +02:00
Laurențiu Nicola
0ea056552a
Revert "Detect NulInCStr
error earlier."
...
This reverts commit 6001c50cac
.
2024-01-21 21:10:05 +02:00
Laurențiu Nicola
ef6e6dfb1a
Merge remote-tracking branch 'upstream/master' into sync-from-rust
2024-01-21 21:08:04 +02:00
Laurențiu Nicola
e4866b6ddb
Merge commit 'a9116523604c998e7781f60d3b5a6f586e0414a9' into sync-from-ra
2024-01-21 16:53:06 +02:00
Nadrieril
0661390ad4
Rollup merge of #120084 - weihanglo:pkgid-spec, r=Mark-Simulacrum
...
fix(rust-analyzer): use new pkgid spec to compare
Starting from rust-lang/cargo#13311 , Cargo's compiler artifact message
uses Package ID specification as package's identifier format.
Zulip topic: https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/proc-macro-test.20bootstrap.20and.20pkgid.20JSON
cc `@ehuss`
2024-01-21 06:38:38 +01:00
r0cky
1a9ef233b7
Remove unused codes
2024-01-21 12:56:23 +08:00
bors
d4926c10b2
Auto merge of #16405 - dfireBird:guarded-return-for-loop, r=lnicola
...
fix: Include `for` construct in convert to guarded return conditions
2024-01-20 16:13:31 +00:00
dfireBird
721e79035d
include for
in convert to guarded return assist
2024-01-20 19:26:50 +05:30
bors
0c764216d5
Auto merge of #16396 - Young-Flash:fix_marco, r=Veykril
...
fix panic with reference in macro
it panic at `builder.make_mut(segment)`, where segment is from macro expand. And the usage reference in orginal macro call isn't a `PathSegment` so we can't update it in `apply_references`, I can't find a way to deal with it properly so here just filter out the reference in macro. LMK if there are better way to fix this
try to close https://github.com/rust-lang/rust-analyzer/issues/16328
2024-01-20 08:12:44 +00:00
Young-Flash
f9b5e0d219
minor: use reference.range
to get original range
2024-01-20 14:43:42 +08:00
Johann Hemmann
9e837790d1
redundant_locals
2024-01-19 18:36:32 +01:00
Johann Hemmann
b1a0c9ac40
single_match
2024-01-19 18:31:15 +01:00
Johann Hemmann
9dd07f0bc4
should_implement_trait
2024-01-19 17:53:09 +01:00
Johann Hemmann
159b4c9fe9
search_is_some
2024-01-19 17:52:55 +01:00
Johann Hemmann
71d4dba960
redundant_pattern_matching
2024-01-19 17:31:01 +01:00
Johann Hemmann
5a62a0db46
redundant_closure
2024-01-19 17:31:01 +01:00
Johann Hemmann
3cf1358eb8
question_mark
2024-01-19 17:31:01 +01:00
Johann Hemmann
6738edc259
ptr_arg
2024-01-19 17:31:01 +01:00
Johann Hemmann
9527e245c9
redundant_locals
2024-01-19 17:31:01 +01:00
Johann Hemmann
692212bbdd
partialeq_to_none
2024-01-19 17:31:01 +01:00
Johann Hemmann
7e8568b293
option_map_unit_fn
2024-01-19 17:31:01 +01:00
Johann Hemmann
4858a3784d
op_ref
2024-01-19 17:31:01 +01:00
Johann Hemmann
0df30499d0
only_used_in_recursion
2024-01-19 17:31:01 +01:00
Johann Hemmann
bef355168a
non_minimal_cfg
2024-01-19 17:31:01 +01:00
Johann Hemmann
e6f9f4c0e4
nonminimal_bool
2024-01-19 17:31:01 +01:00
Johann Hemmann
e58b683201
needless_return
2024-01-19 17:31:01 +01:00
Johann Hemmann
a342e936e3
needless_lifetimes
2024-01-19 17:31:01 +01:00
Johann Hemmann
3839f9a9a2
needless_borrow
2024-01-19 17:31:01 +01:00
Johann Hemmann
d351cb8dfb
match_single_binding
2024-01-19 17:31:01 +01:00
Johann Hemmann
add40c8660
match_like_matches_macro
2024-01-19 17:31:01 +01:00
Johann Hemmann
2ae2512378
if_same_then_else
2024-01-19 17:31:01 +01:00
Johann Hemmann
c27b6b5308
filter_map_bool_then
2024-01-19 17:31:01 +01:00
Johann Hemmann
575398134e
explicit_auto_deref
2024-01-19 17:31:01 +01:00
Johann Hemmann
84494d1c8e
from_str_radix_10
2024-01-19 17:31:01 +01:00
Johann Hemmann
8982ff3bba
get_first
2024-01-19 17:31:01 +01:00
Johann Hemmann
eb7aec5a8e
map_clone
2024-01-19 17:31:01 +01:00
Johann Hemmann
6709eaba2a
never_loop
2024-01-19 17:31:01 +01:00
Johann Hemmann
9e4f94c938
no_effect
2024-01-19 17:31:01 +01:00
Johann Hemmann
c629ec7611
clone_on_copy
2024-01-19 17:31:01 +01:00
Johann Hemmann
6a2a603a8c
let_and_return
2024-01-19 17:31:00 +01:00
Johann Hemmann
d8ad4afce8
manual_map
2024-01-19 17:31:00 +01:00
Johann Hemmann
60dda08266
manual_find
2024-01-19 17:31:00 +01:00
Johann Hemmann
2a500d5280
for_kv_map
2024-01-19 17:31:00 +01:00
Johann Hemmann
882289b229
double_parens
2024-01-19 17:31:00 +01:00
Johann Hemmann
4184c6af0d
collapsible_match
2024-01-19 17:31:00 +01:00
Johann Hemmann
657376858f
iter_kv_map
2024-01-19 17:31:00 +01:00
Johann Hemmann
b5eca5f2fc
collapsible_if
2024-01-19 17:31:00 +01:00
Johann Hemmann
3409645c3f
bind_instead_of_map
2024-01-19 17:31:00 +01:00
bors
2a239b9833
Auto merge of #16401 - Urhengulas:lint-table, r=Veykril
...
Expand lint tables && make clippy happy 🎉
This PR expands the lint tables on `./Cargo.toml` and thereby makes `cargo clippy` exit successfully! 🎉
Fixes #15918
## How?
In the beginning there are some warnings for rustc.
Next, and most importantly, there is the clippy lint table. There are a few sections in there.
First there are the lint groups.
Second there are all lints which are permanently allowed with the reasoning why they are allowed.
Third there is a huge list of temporarily allowed lints. They should be removed in the mid-term, but incur a substantial amount of work, therefore they are allowed for now and can be worked on bit by bit.
Fourth there are all lints which should warn.
Additionally there are a few allow statements in the code for lints which should be permanently allowed in this specific place, but not in the whole code base.
## Follow up work
- [ ] Run clippy in CI
- [ ] Remove tidy test (at least `@Veykril` wrote this in #15017 )
- [ ] Work on temporarily allowed lints
2024-01-19 16:09:02 +00:00
bors
04edfa1e5a
Auto merge of #16388 - Veykril:fn-abi, r=Veykril
...
internal: Record FnAbi
This unfortunately breaks our lub coercions, so will need to look into fixing that first, though I am not sure what is going wrong where...
Stubbed some stuff out for the time being.
2024-01-19 14:37:58 +00:00
bors
03d4a6dd9a
Auto merge of #16400 - alibektas:15656/update_bail_message_ref_config, r=Veykril
...
Update bail message referencing config
Even though we changed the name of the config I forgot to update the warning message that referenced it.
2024-01-19 14:19:11 +00:00
Lukas Wirth
46e38318a2
Stub out FnAbi::partial_eq as a workaround for now
2024-01-19 15:15:23 +01:00
Lukas Wirth
3a722bdf2e
feat:Record FnAbi
2024-01-19 15:15:23 +01:00
Ali Bektas
0347f81244
Update tests
2024-01-19 15:01:46 +01:00
Ali Bektas
0becb6c819
Update crates/ide-db/src/rename.rs
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2024-01-19 14:33:40 +01:00
Johann Hemmann
3041164301
Temporarily allow all lints which occur
...
They will be removed one by one
2024-01-19 12:52:12 +01:00
bors
85c9a83262
Auto merge of #16398 - Urhengulas:satisfy-clippy, r=Veykril
...
`cargo clippy --fix`
This PR is the result of running `cargo clippy --fix && cargo fmt` in the root of the repository. I did not manually review all the changes, but just skimmed through a few of them. The tests still pass, so it seems fine.
2024-01-19 09:43:35 +00:00
Ali Bektas
431040fe59
Update bail message referencing config
...
Even though we changed the name of the config I forgot
to update the warning message that referenced it.
2024-01-18 22:29:36 +01:00
bors
3f4c6dac3d
Auto merge of #16372 - davidsemakula:import-granularity-one, r=Veykril
...
feat: Add "One" import granularity
Adds a new import granularity option "One" that merges all imports into a single use statement as long as they have the same visibility and attributes.
This is similar to [rustfmt's `imports_granularity = "One"`](https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=import#imports_granularity ).
Fixes : #11361
2024-01-18 15:40:12 +00:00
davidsemakula
67c1c2bd14
update merge item assist implementation for "one" import granularity
2024-01-18 17:26:53 +03:00
bors
48af3ef66d
Auto merge of #16397 - Urhengulas:refactor-parser, r=Veykril
...
Refactor `macro_call` to be consistent with other functions
https://github.com/rust-lang/rust-analyzer/pull/16314#discussion_r1457324734
2024-01-18 14:11:58 +00:00
bors
6d3141679d
Auto merge of #16385 - Urhengulas:fix-tra-doc-links, r=Veykril
...
Fix intra doc links
Fixes #15848
2024-01-18 14:00:35 +00:00
bors
a5b89fffb6
Auto merge of #16391 - alibektas:15656/renaming_allowed_by_config, r=Veykril
...
Add a new config to allow renaming of non-local defs
With #15656 we started disallowing renaming of non-local items. Although this makes sense there are some false positives that impacted users' workflows. So this config aims to mitigate this by giving users the liberty to disable this feature.
The reason why this is a draft is that I saw one of the tests fail and I am not sure if the "got" result even syntactically makes sense
Test case is :
```rust
check(
"Baz",
r#"
//- /lib.rs crate:lib new_source_root:library
pub struct S;
//- /main.rs crate:main deps:lib new_source_root:local
use lib::S$0;
"#,
"use lib::Baz;"
);
```
```
Left:
use lib::Baz;
Right:
use lib::Baz;Baz
Diff:
use lib::Baz;Baz
```
2024-01-18 13:49:14 +00:00
Johann Hemmann
255cde788b
Fix CI 3
2024-01-18 14:22:20 +01:00
Johann Hemmann
28c7fa8dc6
Fix CI 2
2024-01-18 14:18:07 +01:00
Johann Hemmann
2185396481
Fix CI
2024-01-18 14:11:30 +01:00
Johann Hemmann
fad4fa163c
cargo clippy --fix
2024-01-18 13:59:49 +01:00
Johann Hemmann
c81728634b
Handle intra-doc links with anchor
2024-01-18 13:36:11 +01:00
Johann Hemmann
bfc2e568dd
Add tests for intra-doc links
...
The first one succeeds because the functionality is already implemented.
The second one fails and represents the functionality to be implemented
in this PR.
2024-01-18 12:59:43 +01:00
Johann Hemmann
f913d4f4b7
Refactor if-else
2024-01-18 12:59:43 +01:00
Johann Hemmann
b599de193f
Refactor macro_call
to be consistent with other functions
2024-01-18 12:50:36 +01:00
Ali Bektas
21020919e3
v2
2024-01-18 12:09:23 +01:00
bors
1ab8c7fd27
Auto merge of #16349 - Young-Flash:use_error_recovery, r=Veykril
...
fix: add error recovery for use_tree_list parsing
This PR adds error recovery for USE_TREE_LIST parsing, avoid the wrong USE_TREE_LIST making the rest parsing incorrectly.
before
![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/c6643690-f25c-4ad9-93d9-e661ba5b1dc3 )
after
![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/30a58c40-2711-48d2-b2e5-fb208fc8636c )
close https://github.com/rust-lang/rust-analyzer/issues/16227
2024-01-18 09:52:37 +00:00
Lukas Wirth
507448652a
Fix rename test fixtures not accounting for multi file edits
2024-01-18 10:47:02 +01:00
Young-Flash
0bf986d718
add test case with marco reference
2024-01-18 17:43:44 +08:00
Young-Flash
bd26403130
fix panic with reference in macro
2024-01-18 17:43:15 +08:00
Young-Flash
1c61326ca0
add use_tree_completion test
2024-01-18 17:35:01 +08:00
Matthias Krüger
7d4980a4d8
Rollup merge of #119172 - nnethercote:earlier-NulInCStr, r=petrochenkov
...
Detect `NulInCStr` error earlier.
By making it an `EscapeError` instead of a `LitError`. This makes it like the other errors produced when checking string literals contents, e.g. for invalid escape sequences or bare CR chars.
NOTE: this means these errors are issued earlier, before expansion, which changes behaviour. It will be possible to move the check back to the later point if desired. If that happens, it's likely that all the string literal contents checks will be delayed together.
One nice thing about this: the old approach had some code in `report_lit_error` to calculate the span of the nul char from a range. This code used a hardwired `+2` to account for the `c"` at the start of a C string literal, but this should have changed to a `+3` for raw C string literals to account for the `cr"`, which meant that the caret in `cr"` nul error messages was one short of where it should have been. The new approach doesn't need any of this and avoids the off-by-one error.
r? ```@fee1-dead```
2024-01-18 10:34:17 +01:00
bors
2dfa9b86d0
Auto merge of #16384 - Veykril:smolstr, r=Veykril
...
minor: Make use of some new `SmolStr` improvements
2024-01-18 09:30:45 +00:00
roife
04ce4ce440
internal: speedup LineEndings calculation using 'memchr'
2024-01-18 17:03:29 +08:00
Weihang Lo
6231ca5f5e
fix(rust-analyzer): use new pkgid spec to compare
...
Starting from cargo#13311, Cargo's compiler artifact message
uses Package ID specification as package's identifier format.
2024-01-18 07:01:29 +00:00
Ali Bektas
9bd9a17ce5
Add a new config to allow renaming of non-local items
...
With #15656 we started disallowing renaming of non-local items.
Although this makes sense there are some false positives that
impacted users' workflows. So this config aims to mitigate this
by giving users the liberty to disable this feature.
2024-01-18 00:26:22 +01:00
davidsemakula
7db4117156
respect "one" import granularity config in merge imports assist
2024-01-18 01:44:57 +03:00
davidsemakula
4f176b3f7f
update import granularity config and docs
2024-01-18 01:44:57 +03:00
davidsemakula
57d4b5bb0f
add "one" import granularity
2024-01-18 01:44:57 +03:00
davidsemakula
84a3b52a10
properly order raw idents when ordering use trees
2024-01-17 21:46:19 +03:00
Lukas Wirth
83591268ab
minor: Make use of some new SmolStr
improvements
2024-01-17 13:47:15 +01:00
bors
5b62ebc23f
Auto merge of #16383 - Veykril:progress, r=Veykril
...
fix: Fix progress reporting getting stuck
Fixes https://github.com/rust-lang/rust-analyzer/issues/16382
2024-01-17 12:24:43 +00:00
Lukas Wirth
0bdbf497b6
fix: Fix progress reporting getting stuck
2024-01-17 13:23:00 +01:00
Johann Hemmann
76c67dd229
Fix test
2024-01-17 12:49:58 +01:00
Johann Hemmann
5916da2c29
Handle macro_rules!
as MACRO_CALL
...
It's a call of the third token is neither IDENT or TRY
2024-01-17 12:07:17 +01:00
bors
2b02df27c5
Auto merge of #16380 - Veykril:sysroot-ci, r=Veykril
...
Run metadata on sysroot for CI metrics
2024-01-17 09:33:14 +00:00
bors
f4fec4ff65
Auto merge of #16378 - roife:fix/issue-15470, r=Veykril
...
fix: better handling of SelfParam in assist 'inline_call'
fix #15470 .
The current `inline_call` directly translates `&self` into `let ref this = ...;` and `&mut self` into `let ref mut this = ...;`. However, it does not handle some complex scenarios.
This PR addresses the following transformations (assuming the receiving object is `obj`):
- `self`: `let this = obj`
- `mut self`: `let mut this = obj`
- `&self`: `let this = &obj`
- `&mut self`
+ If `obj` is `let mut obj = ...`, use a mutable reference: `let this = &mut obj`
+ If `obj` is `let obj = &mut ...;`, perform a reborrow: `let this = &mut *obj`
2024-01-17 08:43:13 +00:00
Lukas Wirth
21723cb051
Run metadata on sysroot for CI metrics
2024-01-17 09:43:04 +01:00
roife
920e99aacb
test: add tests for variant kinds of SelfParam in inline_call
2024-01-17 14:19:57 +08:00
roife
d48498f360
fix: better handling of SelfParam in inline_call
2024-01-17 13:49:07 +08:00
Lukas Wirth
0a75a8c061
Notable traits for type info hovers
2024-01-16 20:15:31 +01:00
Lukas Wirth
ffeaee84af
Goto type actions for notable trait hovers
2024-01-16 19:59:55 +01:00
Lukas Wirth
82e8355492
feat: Show notable trait impls on hover
2024-01-16 19:17:33 +01:00
roife
7c94c29648
fix: make let_stmts inserted in inline_call correctly indented
2024-01-16 21:42:29 +08:00
Lukas Wirth
384488c157
feat: Hover for literals showing additional value information
2024-01-16 14:28:47 +01:00
Lukas Wirth
6584e63506
minor: Simplify
2024-01-16 13:36:07 +01:00
bors
0a8c7841e0
Auto merge of #16352 - davidsemakula:rustfmt-import-sort-algo, r=Veykril
...
internal: Follow rustfmt's algorithm for ordering imports when ordering and merging use trees
Updates use tree ordering and merging utilities to follow rustfmt's algorithm for ordering imports.
The [rustfmt implementation](6356fca675/src/imports.rs
) was used as reference.
2024-01-16 11:23:03 +00:00
bors
63c4e6993f
Auto merge of #16367 - Veykril:value-ty, r=Veykril
...
fix: Make `value_ty` query fallible
2024-01-16 11:11:31 +00:00
Lukas Wirth
8f4f5a6cce
fix: Make value_ty query fallible
2024-01-16 12:09:40 +01:00
davidsemakula
1f91c487a2
move is_upper_snake_case to stdx
2024-01-16 13:37:22 +03:00
davidsemakula
5b2a2bc3fb
remove unnecessary ref patterns
2024-01-16 13:26:49 +03:00
bors
2d5ce888de
Auto merge of #16366 - Veykril:transp-queries, r=Veykril
...
internal: Make data queries transparent over their diagnostics variant
And a few other QoL things
2024-01-16 10:09:05 +00:00
Lukas Wirth
f675b5ead8
Don't early exit on panics in rustc_tests command
2024-01-16 11:05:50 +01:00
Lukas Wirth
54f2111f69
internal: Make data queries transparent over their diagnostics variant
2024-01-16 10:47:54 +01:00
Lukas Wirth
90a1b484f7
Render AstIds in item-tree view
2024-01-16 10:47:28 +01:00