Commit Graph

332 Commits

Author SHA1 Message Date
Lukas Wirth
2fa57d90bc internal: macro_arg query always returns a TokenTree 2024-02-12 17:19:41 +01:00
Lukas Wirth
e2a985e93f Encode disabled proc-macros via boolean flag, not special Expander 2024-02-12 13:39:38 +01:00
tamasfe
6d45afd8d8 feat: ignored and disabled macro expansion 2024-02-12 12:50:40 +01:00
Lukas Wirth
5136705fad internal: Remove SELF_REF hack for self referential SyntaxContexts 2024-02-10 16:20:02 +01:00
Tetsuharu Ohzeki
cb95ee3bc0 hir-def: Fix warnings about clippy str_to_string rule 2024-02-10 01:00:40 +09:00
Tetsuharu Ohzeki
7669619f9a clippy: Enable self_named_constructors rule 2024-02-09 22:31:21 +09:00
austaras
dad0fdb13f fix: preserve where clause when builtin derive 2024-02-08 22:44:39 +08:00
GnomedDev
a607e1b04b
Use reserve_exact for pushing to Subtree 2024-02-04 22:17:20 +00:00
GnomedDev
8011b56827
Swap Subtree::token_trees from Vec to boxed slice 2024-02-04 00:28:22 +00: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
Johann Hemmann
c4302eaa56 unnecessary_lazy_evaluations 2024-01-31 19:06:18 +01:00
Lukas Wirth
d252247ab7 internal: Remove unnecessary usages of ExpansionInfo 2024-01-31 09:57:17 +01: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
Johann Hemmann
43b1ae0446 cargo clippy --fix 2024-01-30 14:50:21 +01: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
YangzeLuo
b22e772cab feat: Support for GOTO def from *inside* files included with include! macro 2024-01-27 23:36:01 +08:00
Lukas Wirth
8a5829cf28 Re-order mod declarations 2024-01-27 11:02:34 +01:00
Lukas Wirth
6cf7b5f8d7 Don't parse intra doc links as syntax trees 2024-01-26 20:00:47 +01: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
Johann Hemmann
3041164301 Temporarily allow all lints which occur
They will be removed one by one
2024-01-19 12:52:12 +01:00
Johann Hemmann
fad4fa163c cargo clippy --fix 2024-01-18 13:59:49 +01:00
Lukas Wirth
83591268ab minor: Make use of some new SmolStr improvements 2024-01-17 13:47:15 +01:00
Lukas Wirth
d80d2fcae0 Eagerly lower enum variants in CrateDefMap construction 2024-01-15 10:24:14 +01:00
bors
9d8889cdfc Auto merge of #16348 - Veykril:nested-includes, r=Veykril
fix: Fix nested includes resolving from the wrong base file

Fixes https://github.com/rust-lang/rust-analyzer/issues/16109
2024-01-11 11:53:24 +00:00
Lukas Wirth
215ede8497 fix: Fix nested includes resolving from the wrong base file 2024-01-11 12:41:47 +01:00
Lukas Wirth
b6e6d5d3af internal: Consider all kinds of explicit private imports in find_path 2024-01-11 12:22:04 +01:00
bors
d5366b5c19 Auto merge of #16265 - Patryk27:suggest-pub-crate-imports, r=Veykril
fix: Acknowledge `pub(crate)` imports in import suggestions

rust-analyzer has logic that discounts suggesting `use`s for private imports, but that logic is unnecessarily strict - for instance given this code:

```rust
mod foo {
    pub struct Foo;
}

pub(crate) use self::foo::*;

mod bar {
    fn main() {
        Foo$0;
    }
}
```

... RA will suggest to add `use crate::foo::Foo;`, which not only makes the code overly verbose (especially in larger code bases), but also is disjoint with what rustc itself suggests.

This commit adjusts the logic, so that `pub(crate)` imports are taken into account when generating the suggestions; considering rustc's behavior, I think this change doesn't warrant any extra configuration flag.

Note that this is my first commit to RA, so I guess the approach taken here might be suboptimal - certainly feels somewhat hacky, maybe there's some better way of finding out the optimal import path 😅
2024-01-11 09:54:22 +00:00
Patryk Wychowaniec
76aaf17794
Suggest pub(crate) imports
rust-analyzer has logic that discounts suggesting `use`s for private
imports, but that logic is unnecessarily strict - for instance given
this code:

```rust
mod foo {
    pub struct Foo;
}

pub(crate) use self::foo::*;

mod bar {
    fn main() {
        Foo$0;
    }
}
```

... RA will suggest to add `use crate::foo::Foo;`, which not only makes
the code overly verbose (especially in larger code bases), but also is
disjoint with what rustc itself suggests.

This commit adjusts the logic, so that `pub(crate)` imports are taken
into account when generating the suggestions; considering rustc's
behavior, I think this change doesn't warrant any extra configuration
flag.

Note that this is my first commit to RA, so I guess the approach taken
here might be suboptimal - certainly feels somewhat hacky, maybe there's
some better way of finding out the optimal import path 😅
2024-01-10 18:21:16 +01:00
Lukas Wirth
7dd9f20ce3 Builtin derives are hygienic 2024-01-08 12:50:11 +01:00
bors
9279c6566b Auto merge of #16237 - Veykril:expand-arc-alloc, r=Veykril
internal: Remove unnecessary `Arc` allocations in `macro_expand`
2024-01-03 14:40:10 +00:00
Lukas Wirth
3fc043ce9b internal: Remove unnecessary Arc allocations in macro_expand 2024-01-03 15:21:18 +01:00
Lukas Wirth
cf22f02dc5 fix: Fix focus range being discarded in attributes/derives when upmapping 2024-01-03 12:15:28 +01:00
bors
86e559bf3f Auto merge of #16211 - tetsuharuohzeki:update-lint, r=Veykril
Use Cargo's [workspace.lints.*] to config clippy

This change begin to use [`[workspace.lints.*]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table) that is stabilized since [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html).

By this change, we make the configure more readable and simplify `xargo lint` more.
2024-01-02 14:53:22 +00:00
Lukas Wirth
0c3fbba3b9 fix: Fix SyntaxContextID using incorrect self IDs 2024-01-01 12:54:30 +01:00
HoLLy
c13330971d Fix out-of-bounds panic in some macros due to unhandled self_ref 2023-12-31 12:51:43 +01:00
Tetsuharu Ohzeki
efc87092b3 Use Cargo's [workspace.lints.*] to config clippy 2023-12-29 23:51:32 +09:00
Lukas Wirth
9e8e124269 Special case fixup spans in server::Span impl, they are immutable 2023-12-22 10:13:00 +01:00
Lukas Wirth
874df3bffa Add eager-expand comment 2023-12-21 17:23:36 +01:00
Lukas Wirth
428a34a9b4 Implement server::Span::Join 2023-12-21 17:23:04 +01:00
Lukas Wirth
5bdb479131 fix: Fix span marking for builtin fn macros 2023-12-21 16:20:27 +01:00
Lukas Wirth
1e1113cf5f Correctly set and mark the proc-macro spans 2023-12-21 10:51:54 +01:00
Lukas Wirth
7d762d18ed Record macro def site spans 2023-12-21 09:54:47 +01:00
Lukas Wirth
51a9e7831a Rename some things and turn macro to macro def into a query 2023-12-21 09:18:25 +01:00
Lukas Wirth
071fe4e4e9 Move Intern and Lookup traits to hir-expand 2023-12-20 21:24:20 +01:00