Commit Graph

27260 Commits

Author SHA1 Message Date
bors
9975650b3e Auto merge of #16041 - roife:fix-line-index-widechar, r=Veykril
Fix WideChar offsets calculation in `line-index`

Fix #15981. This PR addresses the issue with the WideChar's offset calculation, ensuring accurate line-specific positions during text analysis in the `lib/line-index` module.

## Changes Made

- Corrected the calculation for `WideChar` offsets, ensuring they reflect positions within respective lines.
- Added tests to verify the accuracy of `WideChar` offset calculations, and correct existing tests.
2023-12-07 16:27:31 +00:00
bors
421a0a4ff4 Auto merge of #15990 - Young-Flash:trait_impl_reduntant_assoc_item, r=Veykril
feat: add trait_impl_reduntant_assoc_item diagnostic

part of https://github.com/rust-lang/rust-analyzer/issues/15958, will try to add quickfix for the diagnostic if this PR is ok with you guys
2023-12-07 13:24:57 +00:00
Young-Flash
fbe494a106 fix: change default diagnostic range into impl body 2023-12-07 20:45:42 +08:00
bors
07d3128de2 Auto merge of #16043 - Veykril:dep-bump, r=Veykril
Bump and unlock some dependencies
2023-12-07 10:52:52 +00:00
Lukas Wirth
5544f4fa3d Bump and unlock some dependencies 2023-12-07 11:48:58 +01:00
bors
c4f0da96b3 Auto merge of #16042 - Veykril:salsa-bump, r=Veykril
internal: Bump salsa

Might f ix https://github.com/rust-lang/rust-analyzer/issues/15008, haven't tested
2023-12-07 09:59:50 +00:00
Lukas Wirth
45d81048c9 internal: Bump salsa 2023-12-07 10:57:51 +01:00
roife
a011b6c84c fix: correct existing tests for WideChar in lib 'line-index' and add more tests 2023-12-07 15:33:28 +08:00
roife
9a3167e65e fix: correct calculation for fields in WideChar for line-specific positions 2023-12-07 15:30:00 +08:00
bors
6557151dca Auto merge of #16038 - Veykril:lsp-server-bump, r=Veykril
Publish lsp-server 0.7.5
2023-12-06 21:01:50 +00:00
Lukas Wirth
a84685a58d Publish lsp-server 0.7.5 2023-12-06 22:00:01 +01:00
bors
311a5e9253 Auto merge of #15986 - davidbarsky:david/move-to-arc-iter, r=lnicola
internal: move to `Arc::from_iter`

Builds atop of https://github.com/rust-lang/rust-analyzer/pull/15985, will rebase.
2023-12-06 18:14:10 +00:00
David Barsky
c17dcc8d90 internal: switch to Arc::from_iter 2023-12-06 13:08:45 -05:00
bors
7e8a3391bb Auto merge of #16037 - Veykril:proc-macro-backtrace, r=Veykril
fix: Don't print proc-macro panic backtraces in the logs

Fixes https://github.com/rust-lang/rust-analyzer/issues/9859
2023-12-06 17:02:17 +00:00
Lukas Wirth
80dc20f7d8 fix: Don't print proc-macro panic backtraces in the logs 2023-12-06 17:49:48 +01:00
bors
9e8d7931e0 Auto merge of #16036 - JoJoDeveloping:expose-param-lowering-mode, r=lnicola
make ParamLoweringMode accessible

In `hir-ty`, the `TyLoweringContext` has functions `pub fn with_impl_trait_mode` and `pub fn with_type_param_mode`, which can be used to fine-tune certain lowering properties.
Each of these takes one enum (either `pub enum ImplTraitLoweringMode`, or `pub enum ParamLoweringMode`), which encodes the possible configuration options.

To then make this usable for other crates, `TyLoweringContext` and `ImplTraitLoweringMode` are exported. Unfortuntely, `ParamLoweringMode` is not. This means that while the method can be called, there are no useful values to call it with.

Presumably this is an oversight. It would be great if this was made actually public.
2023-12-06 15:36:23 +00:00
Young-Flash
861e47431b update: make each trait_impl_reduntant_assoc_item into individual diagnostic 2023-12-06 22:17:55 +08:00
Young-Flash
5d84edd430 feat: add trait_impl_reduntant_assoc_item diagnostic 2023-12-06 22:17:55 +08:00
Johannes Hostert
374affea3c
make ParamLoweringMode accessible 2023-12-06 15:12:55 +01:00
bors
77e362c34d Auto merge of #16035 - Veykril:macro-diagnostics, r=Veykril
fix: Fix diagnostics panicking when resolving to different files due to macros

Fixes https://github.com/rust-lang/rust-analyzer/issues/14968
2023-12-06 13:50:36 +00:00
Lukas Wirth
ba01ff4f88 Fix diagnostics panicking when resolving to different files due to macros 2023-12-06 14:39:26 +01:00
Lukas Wirth
634d588fd7 Simplify 2023-12-06 14:36:39 +01:00
bors
cc8faa697c Auto merge of #16034 - Veykril:ide-macro-improvements, r=Veykril
feat: Allow navigation targets to be duplicated when the focus range lies in the macro definition site

![Code_KI1EfbAHRZ](https://github.com/rust-lang/rust-analyzer/assets/3757771/2cc82e5c-320f-4de2-9d55-fe975d180f2a)

Basically if a name of an item originates from the macro definition we now point to that as well as the creating macro call.

Big diff because I also made `FileId`s field private due to some debugging I had to do (having a searchable constructor makes things easier).
2023-12-06 11:47:46 +00:00
Lukas Wirth
9cb13b6efb Allow navigation targets to be duplicated when the focus range lies in the macro definition site 2023-12-06 12:38:19 +01:00
Michael Goulet
76c972cb54 Rollup merge of #118123 - RalfJung:internal-lib-features, r=compiler-errors
Add support for making lib features internal

We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.

This extends that idea to lib features as well. It is an alternative to https://github.com/rust-lang/rust/pull/115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in `_internals` or `_internal` is considered internal.

Then we rename `core_intrinsics` to `core_intrinsics_internal`, which fixes https://github.com/rust-lang/rust/issues/115597.
2023-12-05 14:52:41 -05:00
bors
05df6c52ca Auto merge of #16027 - Veykril:implicit-format-args, r=Veykril
feat: Implicit format args support

Fixes https://github.com/rust-lang/rust-analyzer/issues/11260
Fixes https://github.com/rust-lang/rust-analyzer/issues/11296

![image](https://github.com/rust-lang/rust-analyzer/assets/3757771/14fe2caf-4ea3-40a5-8aa4-ff08ea0ccbde)
Too lazy to make a gif of this right now (would probably be good to show renaming)
2023-12-05 16:15:45 +00:00
Lukas Wirth
9b7ec5e31b Ignore strings in token trees in syntax highlighting 2023-12-05 17:07:00 +01:00
Lukas Wirth
4525787ed5 Add test for implicit format args support through nested macro call 2023-12-05 17:07:00 +01:00
Lukas Wirth
fe0a85ca29 Resolve implicit format args in syntax highlighting 2023-12-05 17:07:00 +01:00
Lukas Wirth
d2cd30007c Implicit format args support 2023-12-05 17:07:00 +01:00
Lukas Wirth
5b8e386bae Improve macro descension API 2023-12-05 17:06:57 +01:00
Young-Flash
afc4075c7c fix: make drop inlay hint more readable 2023-12-05 22:56:51 +08:00
bors
afc1ae1aa3 Auto merge of #16016 - dfireBird:regression-fix-15879, r=lnicola
fix: Insert fn call parens only if the parens inserted around field name

Fixes #16014.

Sorry I missed it in previous PR. I've added a test as level to prevent regressions again.
Give any suggestions to improve the test if anything.
2023-12-05 14:53:29 +00:00
bors
986577faaa Auto merge of #16026 - lnicola:bump-rustc-deps, r=lnicola
minor: Bump rustc deps
2023-12-05 11:42:14 +00:00
Laurențiu Nicola
73b9f885f6 Bump ra-ap-rustc_index and ra-ap-rustc_abi 2023-12-05 13:40:29 +02:00
Laurențiu Nicola
22676ce946 Revert "Temporarily revert delay_bug to delayed_bug change"
This reverts commit 6d2543b622.
2023-12-05 13:39:45 +02:00
Laurențiu Nicola
a9b037f510 Bump ra-ap-rustc_parse_format 2023-12-05 13:39:17 +02:00
Laurențiu Nicola
1834b38dbe Bump ra-ap-rustc_lexer 2023-12-05 13:38:35 +02:00
bors
a90a42b407 Auto merge of #16022 - Xanewok:no-warn-semicolon-in-expr-from-macros, r=lnicola
internal: Don't explicitly warn against `semicolon_in_expressions_from_macros`

This has been warn-by-default for two years now and has already been added to the future-incompat lints in 1.68.

See https://github.com/rust-lang/rust/issues/79813 for the tracking issue.
2023-12-05 11:23:25 +00:00
bors
ceb4426cd6 Auto merge of #16024 - lnicola:debug-workspace-path, r=lnicola
fix: Fix runnable cwd on Windows

Fixes #16010
2023-12-05 11:11:43 +00:00
Laurențiu Nicola
9dc38214c0 Fix runnable cwd on Windows 2023-12-05 13:09:01 +02:00
Igor Matuszewski
a7224c998d Don't explicitly warn against semicolon_in_expressions_from_macros
This has been warn-by-default for two years now and has already been
added to the future-incompat lints in 1.68.
2023-12-05 11:35:09 +01:00
bors
2d66f6df25 Auto merge of #16018 - lnicola:no-debug, r=Veykril
minor: Disable debuginfo again

I suspect this wasn't intentional, right?
2023-12-04 20:30:20 +00:00
Laurențiu Nicola
523ad0f634 Disable debuginfo again 2023-12-04 22:15:59 +02:00
bors
e91fdf7860 Auto merge of #15959 - Veykril:macro-shower3, r=lnicola
TokenMap -> SpanMap rewrite

Opening early so I can have an overview over the full diff more easily, still very unfinished and lots of work to be done.

The gist of what this PR does is move away from assigning IDs to tokens in arguments and expansions and instead gives the subtrees the text ranges they are sourced from (made relative to some item for incrementality). This means we now only have a single map per expension, opposed to map for expansion and arguments.

A few of the things that are not done yet (in arbitrary order):
- [x] generally clean up the current mess
- [x] proc-macros, have been completely ignored so far
- [x] syntax fixups, has been commented out for the time being needs to be rewritten on top of some marker SyntaxContextId
- [x] macro invocation syntax contexts are not properly passed around yet, so $crate hygiene does not work in all cases (but most)
  - [x] builtin macros do not set spans properly, $crate basically does not work with them rn (which we use)
~~- [ ] remove all uses of dummy spans (or if that does not work, change the dummy entries for dummy spans so that tests will not silently pass due to havin a file id for the dummy file)~~
  - [x] de-queryfy `macro_expand`, the sole caller of it is `parse_macro_expansion`, and both of these are lru-cached with the same limit so having it be a query is pointless
- [x] docs and more docs
- [x] fix eager macro spans and other stuff
  - [x] simplify include! handling
- [x] Figure out how to undo the sudden `()` expression wrapping in expansions / alternatively prioritize getting invisible delimiters working again
- [x] Simplify InFile stuff and HirFIleId extensions
~~- [ ] span crate containing all the file ids, span stuff, ast ids. Then remove the dependency injection generics from tt and mbe~~

Fixes https://github.com/rust-lang/rust-analyzer/issues/10300
Fixes https://github.com/rust-lang/rust-analyzer/issues/15685
2023-12-04 19:59:53 +00:00
bors
11e1ceaf75 Auto merge of #16017 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2023-12-04 19:43:27 +00:00
Laurențiu Nicola
6d2543b622 Temporarily revert delay_bug to delayed_bug change 2023-12-04 21:41:19 +02:00
Laurențiu Nicola
26c0963281 Merge branch 'master' into sync-from-rust 2023-12-04 21:39:22 +02:00
dfireBird
20c6f27024
Insert fn call parens only if the parens inserted around field name 2023-12-04 22:37:34 +05:30
ClSlaid
b21d68cd2a
feat: add proc-macro rebuild on save option
Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
2023-12-04 21:08:29 +08:00