Commit Graph

25389 Commits

Author SHA1 Message Date
Lukas Wirth
2aa44c8e37 internal: Don't reparse files when trying to expand assoc item macro calls 2023-04-22 11:02:11 +02:00
Ralf Jung
918b78e066 Merge from rustc 2023-04-22 10:35:35 +02:00
bors
1379b5fac7 Auto merge of #14630 - Veykril:arc, r=Veykril
internal: `Arc<String>` -> `Arc<str>`
2023-04-22 07:58:13 +00:00
Lukas Wirth
f2295cda42 Report vfs memory usage in status command 2023-04-22 09:57:48 +02:00
Lukas Wirth
f00dcf9a69 internal: Arc<String> -> Arc<str> 2023-04-22 09:48:37 +02:00
bors
11c55b2e27 Auto merge of #14629 - Veykril:stats, r=Veykril
internal: Add some additional status ouput

We should be able to use this infra to get a better grasp about what we might want to LRU
2023-04-22 07:35:29 +00:00
Lukas Wirth
63e3bf118d internal: Add some additional status ouput 2023-04-22 09:34:47 +02:00
bors
779b891526 Auto merge of #14628 - Veykril:symbols, r=Veykril
internal: Restructure symbol queries a bit
2023-04-22 07:04:33 +00:00
Lukas Wirth
e7285507f6 Restructure symbol queries 2023-04-22 08:27:10 +02:00
bors
fcbbec6c6e Auto merge of #14625 - jhgg:fix/token-conversion-for-doc-comments, r=Veykril
mbe: fix token conversion for doc comments

fixes #14611

when creating token trees for the converted doc comment, we should use the correct span in all places, rather than allowing some to remain unspecified. otherwise, things behave incorrectly.
2023-04-22 05:23:18 +00:00
Jake Heinz
a497e9a05e mbe: fix token conversion for doc comments 2023-04-22 03:06:06 +00:00
alibektas
caa13b3f95 Small changes in str formatting 2023-04-21 22:09:11 +03:00
bors
af3b6a0893 Auto merge of #14621 - alibektas:make_impl_trait_fix, r=Veykril
Simple fix for make::impl_trait

This is my first PR in this project. I made this PR because I needed this function to work properly for the main PR I am working on  (#14386). This is a small amendment to what it was before. We still need to improve this in order for it to fully comply with its syntactic definition as  stated [here](https://doc.rust-lang.org/reference/items/implementations.html).
2023-04-21 18:25:42 +00:00
alibektas
7c9e4e10bc Add syntax::make::ty_alias
The function is fully compliant with the specifications from the Rust Reference.
2023-04-21 21:19:36 +03:00
alibektas
4601331ceb Simple fix for make::impl_trait 2023-04-21 20:46:57 +03:00
bors
3a08713caa Auto merge of #14619 - HKalbasi:dev3, r=Veykril
Fix need-mut large span in closures and a false positive

fix #14612
2023-04-21 15:10:27 +00:00
bors
6df808215b Auto merge of #109002 - michaelvanstraten:master, r=petrochenkov
Added byte position range for `proc_macro::Span`

Currently, the [`Debug`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#impl-Debug-for-Span) implementation for [`proc_macro::Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#) calls the debug function implemented in the trait implementation of `server::Span` for the type `Rustc` in the `rustc-expand` crate.

The current implementation, of the referenced function, looks something like this:
```rust
fn debug(&mut self, span: Self::Span) -> String {
    if self.ecx.ecfg.span_debug {
        format!("{:?}", span)
    } else {
        format!("{:?} bytes({}..{})", span.ctxt(), span.lo().0, span.hi().0)
    }
}
```

It returns the byte position of the [`Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#) as an interpolated string.

Because this is currently the only way to get a spans position in the file, I might lead someone, who is interested in this information, to parsing this interpolated string back into a range of bytes, which I think is a very non-rusty way.

The proposed `position()`, method implemented in this PR, gives the ability to directly get this info.
It returns a [`std::ops::Range`](https://doc.rust-lang.org/std/ops/struct.Range.html#) wrapping the lowest and highest byte of the [`Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#).

I put it behind the `proc_macro_span` feature flag because many of the other functions that have a similar footprint also are annotated with it, I don't actually know if this is right.

It would be great if somebody could take a look at this, thank you very much in advanced.
2023-04-21 10:47:27 +00:00
hkalbasi
0c621065fb Fix need-mut large span in closures and a false positive 2023-04-21 02:15:19 +03:30
bors
0289dfa261 Auto merge of #14599 - HKalbasi:dev2, r=HKalbasi
Detect sysroot dependencies using symlink copy

cc #7637

It is currently in a proof of concept stage, and it doesn't generates a copy. You need to provide your own sysroot copy in `/tmp/ra-sysroot-hack` in a way that `/tmp/ra-sysroot-hack/library/std/lib.rs` exists and `/tmp/ra-sysroot-hack/Cargo.toml` is [the one from this comment](https://github.com/rust-lang/rust-analyzer/issues/7637#issuecomment-1495008329). I will add the symlink code if we decide that this approach is not a dead end.

It seems to somehow work on my system. Go to definition into std dependencies works, type checking can look through fields if I make them public and `cfg_if` appears to work (I tested it by hovering both sides and seeing that the correct one is enabled). Though finding layout of `HashMap` didn't work.

Please try it and let me know if I should go forward in this direction or not.
2023-04-20 22:26:17 +00:00
bors
5b6655028a Auto merge of #14618 - westernwontons:feature/automatic-parameter-hints-toggle, r=Veykril
fix: `editor.parameterHints.enabled` not always being respected

#13472

When accepting a suggestion, the parameter hints would always trigger automatically. This PR provides the ability for users to toggle this functionality off by specifying the new "rust-analyzer.autoTriggerParameterHints" option in `settings.json`. Possible options are `true` and `false`. It's `true` by default.
2023-04-20 20:19:50 +00:00
hkalbasi
39715ce26f Add RA_UNSTABLE_SYSROOT_HACK 2023-04-20 22:55:39 +03:30
Nagy Botond
36281e0745 using VSCode's native parameterHints.enabled setting 2023-04-20 22:13:33 +03:00
Nagy Botond
770734fdbb Automatic parameter hints trigger can be toggled on/off 2023-04-20 19:41:15 +03:00
Ryo Yoshida
cf72b6232b
Resolve $crate in derive paths 2023-04-20 15:50:17 +09:00
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
bors
112464fd6b Auto merge of #14604 - HKalbasi:dev3, r=Veykril
internal: Add minicore smoke test

fix #14501
2023-04-18 14:34:44 +00:00
hkalbasi
f05f7ab082 Add minicore smoke test 2023-04-18 17:38:38 +03:30
bors
e84781ad58 Auto merge of #14603 - Veykril:workspaces, r=Veykril
fix: Deduplicate passed workspaces by top level cargo workspace they belong to

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

With this we should be supporting vscode workspaces properly
2023-04-18 12:28:00 +00:00
Lukas Wirth
9c408970ea Deduplicate loaded projects 2023-04-18 14:27:01 +02:00
Lukas Wirth
f5f68e4dc7 Make workspace fields of config private 2023-04-18 13:25:54 +02:00
bors
9b835f334f Auto merge of #14594 - Veykril:Simplify, r=Veykril
internal: Move Expander and LowerCtx into separate modules
2023-04-17 19:00:42 +00:00
Lukas Wirth
bca8029a6e Move Expander and LowerCtx into separate modules 2023-04-17 20:44:06 +02:00
bors
b92b7c0d94 Auto merge of #14598 - lowr:fix/release-channel-from-str, r=lnicola
Fix release channel detection

We detect toolchain's release channel by looking at pre-release identifier of cargo/rustc's version string. It's empty for stable, "beta" or "beta.x" for beta, and "nightly" for nightly.

See rust-lang/rust's [bootstrap code] for how the version string is determined.

[bootstrap code]: e49122fb1c/src/bootstrap/lib.rs (L1244)
2023-04-17 18:43:47 +00:00
Ryo Yoshida
4db87f9346
Fix release channel detection
See bootstrap code in rust-lang/rust for versioning details: e49122fb1c/src/bootstrap/lib.rs (L1244)
2023-04-18 02:12:17 +09:00
bors
1f92641093 Auto merge of #14593 - lnicola:bump-deps, r=lnicola
minor: Bump a couple of deps

Only a couple because I didn't yet try to untangle the `windows-sys` / `syn 2.0`.
2023-04-17 16:08:31 +00:00
Laurențiu Nicola
160ab88bb9 Bump bitflags 2023-04-17 18:42:59 +03:00
Laurențiu Nicola
840cfd0862 Bump mimalloc 2023-04-17 17:38:47 +03:00
Laurențiu Nicola
8e192b0298 Bump cargo_metadata 2023-04-17 17:26:55 +03:00
Laurențiu Nicola
1737bd628f Bump proc-macro2 2023-04-17 17:23:09 +03:00
Laurențiu Nicola
966fa604c1 Bump libc 2023-04-17 17:22:07 +03:00
Laurențiu Nicola
3c027fed1b Bump always-assert 2023-04-17 17:21:02 +03:00
Laurențiu Nicola
ad38c30e65 Bump serde_json 2023-04-17 17:19:48 +03:00
bors
5111207d9a Auto merge of #14591 - justahero:gh-14516, r=Veykril
Restrict "sort items" assist for traits & impls

This restricts the "sort items alphabetically" assist when the selection is inside a `Impl` or `Trait` node & intersects with one of the associated items.

It re-orders the conditional checks of AST nodes in the `sort_items` function to check for more specific nodes first before checking `Trait` or `Impl` nodes. The `AssistContext` is passed into the `add_sort_methods_assist` function to check if the selection intersects with any inner items, e.g. associated const or type alias, function. In this case the assist does not apply.

Fixes: #14516
2023-04-17 12:45:31 +00:00
Sebastian Ziebell
c1712e55c6 Restrict "sort items" assist inside Impl & Trait
This fixes the applicability of the "sort items alphabetically" assist
when the selection is inside a `Trait` or `Impl`. It's now tested if the
selection is inside or overlaps with an inner node, e.g. associated
const or type alias, function.
2023-04-17 12:36:32 +02:00
bors
bab80dae44 Auto merge of #14588 - Veykril:macro-def-err, r=Veykril
fix: Actually bring back LRU limit for macro_expand query
2023-04-16 21:13:02 +00:00
Lukas Wirth
fd4bbcabe8 Actually bring back LRU limit for macro_expand query 2023-04-16 23:12:25 +02:00
bors
9b54e39762 Auto merge of #14587 - Veykril:macro-def-err, r=Veykril
fix: Bring back LRU limit for macro_expand query

Should fix the memory increase
2023-04-16 19:30:42 +00:00
Lukas Wirth
76718ea2fc Bring back LRU limit for macro_expand query 2023-04-16 21:30:04 +02:00
bors
924d30a772 Auto merge of #14585 - Veykril:macro-def-err, r=Veykril
Make `ExpandDatabase::parse_macro_expansion` and `ExpandDatabase::parse_or_expand` infallible
2023-04-16 18:50:02 +00:00