Commit Graph

2133 Commits

Author SHA1 Message Date
oxalica
3bfe1d5d78
Display fully qualified associated types correctly
Currently they are formatted in the internal `Trait<Self = Type>::Assoc`
forms where `hir_ty::TypeRef` is formatted, like hover.
2023-08-09 00:04:55 +08:00
bors
af4ba46b40 Auto merge of #15405 - lowr:patch/doc-links-to-fields, r=Veykril
Support doc links that resolve to fields

Fixes #15331

Also removes `Resolver::resolve_module_path_in_trait_assoc_items()` and reimplements it in hir with other `Resolver` methods to decouple things a bit.
2023-08-08 14:13:27 +00:00
bors
f98d654ddf Auto merge of #15350 - max-heller:issue-11756, r=Veykril
Handle `#[cfg]`s on generic parameters

Records attributes on generic parameters in the item tree and filters out generic parameters disabled by `#[cfg]`s in `generic_params_query`.

Closes #11756
2023-08-08 13:05:26 +00:00
Ryo Yoshida
0c433c23b1
Support doc links that resolve to fields 2023-08-07 00:59:35 +09:00
Wilfred Hughes
edabffbd5a SCIP: Qualify parameters by the containing function
SCIP requires symbols to be unique, but multiple functions may have a
parameter with the same name. Qualify parameters according to the
containing function.
2023-08-04 16:38:31 -07:00
Lukas Wirth
6e2c3f610b Remove suspicious unwrap 2023-08-02 12:18:10 +02:00
Lukas Wirth
bcff166b3a Add ExternCrateDecl to HIR 2023-08-02 11:52:55 +02:00
bors
151c750dac Auto merge of #15367 - Veykril:eager-macro-inputs, r=Veykril
fix: Strip unused token ids from eager macro input token maps
2023-08-01 11:23:02 +00:00
Lukas Wirth
a5059da57a Update test fixture 2023-08-01 13:13:56 +02:00
bors
62dcf39ef0 Auto merge of #14723 - obsgolem:master, r=Veykril
Added remove unused imports assist

This resolves the most important part of #5131. I needed to make a couple of cosmetic changes to the search infrastructure to do this.

A few open questions:
* Should imports that don't resolve to anything be considered unused? I figured probably not, but it would be a trivial change to make if we want it.
* Is there a cleaner way to make the edits to the use list?
* Is there a cleaner way to get the list of uses that intersect the current selection?
* Is the performance acceptable? When testing this on itself, it takes a good couple seconds to perform the assist.
* Is there a way to hide the rustc diagnostics that overlap with this functionality?
2023-08-01 09:50:16 +00:00
bors
c71e1368fd Auto merge of #15269 - DropDemBits:structured-snippets-deferred-rendering, r=Veykril
internal: Defer structured snippet rendering to allow escaping snippet bits

Since we know exactly where snippets are, we can transparently escape snippet bits to the exact text edits that need it, and not have to do it for anything other text edits.

Also will eventually fix #11006 once all assists are migrated. This comes as a side-effect of text edits that don't have snippets get marked as having no insert formatting at all.
2023-08-01 09:18:46 +00:00
Lukas Wirth
c7b34e4873 fix: Strip unused token ids from eager macro input token maps 2023-07-31 17:12:17 +02:00
Max Heller
37a8493138 tests 2023-07-28 06:45:35 -04:00
oxalica
51b35ccb1b
Add comments for why skip highlighting for invalid char/byte literals 2023-07-23 04:24:35 +08:00
oxalica
1f35e4d3f1
Introduce invalidEscapeSequence semantic token type 2023-07-19 15:12:53 +08:00
oxalica
59a3e42ac9
Fix unescaping of C string literals 2023-07-18 18:52:34 +08:00
oxalica
de1f766820
Fix highlighting of byte escape sequences
Currently non-UTF8 escape sequences in byte strings and any escape
sequences in byte literals are ignored.
2023-07-17 22:52:58 +08:00
bors
8e5f944317 Auto merge of #15282 - HKalbasi:mir, r=HKalbasi
Give real discriminant_type to chalk
2023-07-14 16:46:35 +00:00
hkalbasi
50559118fb Give real discriminant_type to chalk 2023-07-14 20:15:18 +03:30
hkalbasi
5208bf8f55 implement type_name intrinsic 2023-07-14 16:52:36 +03:30
Lukas Wirth
6a7b905c86 Fix the eager token maps by re-mapping the textranges between the input and input expansion 2023-07-13 09:22:38 +02:00
DropDemBits
97a6fa58cd
internal: Defer rendering of structured snippets
This ensures that any assist using structured snippets won't
accidentally remove bits interpreted as snippet bits.
2023-07-12 01:50:35 -04:00
DropDemBits
89f7bf7411
Add SnippetEdit to be alongside source changes
Rendering of snippet edits is deferred to places using source change
2023-07-12 00:43:41 -04:00
Lukas Wirth
2366c16bf9 Fix eager token mapping panics 2023-07-11 13:54:28 +02:00
Josiah Bills
b9cef03230 Updated search to expose some more functions and to make search take the search scope by reference. 2023-07-09 17:30:21 -04:00
Adenine
d0df00d274 Rework view memory layout tests to use expect_test and to_strings. 2023-07-09 16:11:15 -04:00
Adenine
4d5c66986e cleanup + docs + tests 2023-07-07 23:12:09 -04:00
Adenine
de5e3cf745 fix incorrect committed rust and run prettier 2023-07-07 23:09:41 -04:00
Adenine
cfa15d49aa implement first pass of memory layout viewer 2023-07-07 23:09:41 -04:00
hkalbasi
3a1054fc1c Replace x with it 2023-07-06 17:33:17 +03:30
hkalbasi
171ae2ee5d Fix size_of_val and support min_align_of_val 2023-07-06 15:41:52 +03:30
bors
daba334611 Auto merge of #15206 - Veykril:let-else-fmt, r=Veykril
internal: Format let-else

As nightly finally got support for it I went ahead and formatted r-a with the latest nightly, then with the latest stable (in case other stuff changed)
2023-07-03 18:41:59 +00:00
Lukas Wirth
69cd3c30ac Format let-else 2023-07-03 20:34:09 +02:00
Lukas Wirth
e52027861e Add analysis-stats flag to trigger some IDE features 2023-07-03 16:04:08 +02:00
Lukas Wirth
321e570d92 Don't diagnose builtin derives 2023-07-03 14:23:36 +02:00
Ryo Yoshida
6086ced61d Revert "Support #[rustc_coinductive]"
This reverts commit d026479ba6.
2023-07-03 05:06:55 +09:00
bors
ad434fc4ac Auto merge of #15157 - HKalbasi:tokio-test, r=HKalbasi
Fix runnable detection for `#[tokio::test]`

fix #15141

It is hacky, and it wouldn't work for e.g. this case:
```Rust
use ::core::prelude;

#[prelude::v1::test]
fn foo() {
}
```
But it works for the tokio case. We should use the name resolution here somehow, and after that we should probably also get rid of the ast based `test_related_attribute` function.
2023-06-28 20:02:00 +00:00
hkalbasi
7901538dc8 Fix runnable detection for #[tokio::test] 2023-06-28 23:31:08 +03:30
bors
ae89ca3fbb Auto merge of #15161 - lowr:patch/fixture-metadata-library, r=Veykril
internal: add `library` fixture meta

Currently, there is no way to specify `CrateOrigin` of a file fixture ([this] might be a bug?). This PR adds `library` meta to explicitly specify the fixture to be `CrateOrigin::Library` and also makes sure crates that belong to a library source root are set `CrateOrigin::Library`.

(`library` isn't really the best name. It essentially means that the crate is outside workspace but `non_workspace_member` feels a bit too long. Suggestions for the better name would be appreciated)

Additionally:
- documents the fixture meta syntax as thoroughly as possible
- refactors relevant code

[this]: 4b06d3c595/crates/base-db/src/fixture.rs (L450)
2023-06-28 15:23:32 +00:00
Ryo Yoshida
d51536c242
Add library fixture meta
Additionally documents the syntax for fixture meta.
2023-06-28 22:34:14 +09:00
Ryo Yoshida
d026479ba6
Support #[rustc_coinductive] 2023-06-25 00:13:31 +09:00
hkalbasi
5eb4796d3d Support more intrinsics in mir interpreter 2023-06-23 21:08:05 +03:30
bors
3a4f9a1416 Auto merge of #15110 - HKalbasi:run-test-command, r=HKalbasi
internal: Add run-tests command

This command is similar to `cargo test` except that it uses r-a to run tests instead of compiling and running them with rustc. This is slower than `cargo test` and it is only useful for me to see a bird view of what needs to be fixed. The current output is:
```
48 passed, 5028 failed, 2 ignored
All tests            174.74s, 648ginstr
```
48 is very low, but higher than what I originally thought.

Now that there is some passing tests, I can show the plan:

https://github.com/rust-lang/rust-analyzer/assets/45197576/76d7d777-1843-4ca4-b7fe-e463bdade6cb

That is, at the end, I want to be able to immediately re run every test after every change. (0.5s is not really immediate, but it's not finished yet, and it is way better than 8s that running a typical test in r-a will take on my system)
2023-06-22 16:04:16 +00:00
hkalbasi
674cd5ab57 Add run-tests command 2023-06-22 19:33:37 +03:30
dfireBird
410ede9101
Add some tests in number evaluvation and hover to prevent regression
Added a test near positive extermes and two test near negative
extermes as well one for 0.
Added a test using the `as` cast and one with comparison with 0.
2023-06-22 17:58:12 +05:30
Lukas Wirth
58ac823864 Less eager parsing for module sources 2023-06-17 10:58:52 +02:00
hkalbasi
527dfede48 Support Pointee trait 2023-06-16 16:43:43 +03:30
bors
51939db8d3 Auto merge of #15052 - lnicola:fmt-arguments, r=Veykril
minor: Rename minicore ArgumentV1 to match libcore
2023-06-14 12:13:58 +00:00
Laurențiu Nicola
6d6354e5b5 Rename minicore ArgumentV1 to match libcore 2023-06-14 07:33:37 +03:00
Lukas Wirth
b322805918 internal: Record file dependencies in crate graph construction 2023-06-13 12:29:24 +02:00