Commit Graph

110 Commits

Author SHA1 Message Date
bors
6edf624cbe Auto merge of #12690 - Veykril:inert-attrs, r=Veykril
internal: Update inert attribute list
2022-07-05 09:55:55 +00:00
Lukas Wirth
383ee6af5e internal: Update inert attribute list 2022-07-05 11:54:46 +02:00
Lukas Wirth
db49ac8734 internal: Record all macro definitions in ItemScope 2022-07-05 11:28:47 +02:00
Laurențiu Nicola
6669f388a2 Bump indexmap 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
791f2a0bec Bump smallvec 2022-07-03 10:09:35 +03:00
Laurențiu Nicola
e6fcb23445 Bump either 2022-07-03 10:09:35 +03:00
Florian Diebold
9a12d0d6f2 Fix case of ignored/broken proc macro 2022-07-01 19:00:07 +02:00
bors
ed44fe52e4 Auto merge of #12668 - Veykril:mac-source-map, r=Veykril
fix: Simplify macro statement expansion handling

I only meant to fix https://github.com/rust-lang/rust-analyzer/issues/12644 but that somehow turned into a rewrite of the statement handling ... at least this fixes a few more issues in the IDE layer now
2022-07-01 14:46:48 +00:00
Lukas Wirth
e5e5a0932d Fix blocks not considering stmt without semi as tails 2022-07-01 16:25:52 +02:00
Lukas Wirth
8e764a8bb1 fix: Fix attribute macros on assoc items being discarded with disabled proc macros 2022-07-01 16:21:21 +02:00
Lukas Wirth
58d5c69a63 Fix Expr::MacroStmts using wrong scopes 2022-07-01 15:34:29 +02:00
Lukas Wirth
9165e3b381 Update hir-ty test outputs 2022-07-01 15:21:55 +02:00
Lukas Wirth
531e152390 fix: Simplify macro statement expansion handling 2022-07-01 14:49:30 +02:00
bors
2ff505ab48 Auto merge of #12428 - lowr:experimental/destructuring-assignment, r=flodiebold
feat: implement destructuring assignment

This is an attempt to implement destructuring assignments, or more specifically, type inference for [assignee expressions](https://doc.rust-lang.org/reference/expressions.html#place-expressions-and-value-expressions).

I'm not sure if this is the right approach, so I don't even expect this to be merged (hence the branch name 😉) but rather want to propose one direction we could choose. I don't mind getting merged if this is good enough though!

Some notes on the implementation choices:

- Assignee expressions are **not** desugared on HIR level unlike rustc, but are inferred directly along with other expressions. This matches the processing of other syntaxes that are desugared in rustc but not in r-a. I find this reasonable because r-a only needs to infer types and it's easier to relate AST nodes and HIR nodes, so I followed it.
- Assignee expressions obviously resemble patterns, so type inference for each kind of pattern and its corresponding assignee expressions share a significant amount of logic. I tried to reuse the type inference functions for patterns by introducing `PatLike` trait which generalizes assignee expressions and patterns.
  - This is not the most elegant solution I suspect (and I really don't like the name of the trait!), but it's cleaner and the change is smaller than other ways I experimented, like making the functions generic without such trait, or making them take `Either<ExprId, PatId>` in place of `PatId`.

in case this is merged:
Closes #11532
Closes #11839
Closes #12322
2022-06-30 09:14:12 +00:00
Florian Diebold
8b3ec12aac fix: Report proc macro errors in expressions correctly as well
They didn't have a krate before, resulting in the generic "proc macro
not found" error.

Also improve error messages a bit more.
2022-06-28 10:43:22 +02:00
Florian Diebold
45fd5e697f Improve comments 2022-06-24 14:19:18 +02:00
Florian Diebold
c80c34867f Improve proc macro errors a bit
Distinguish between
 - there is no build data (for some reason?)
 - there is build data, but the cargo package didn't build a proc macro dylib
 - there is a proc macro dylib, but it didn't contain the proc macro we expected
 - the name did not resolve to any macro (this is now an
 unresolved_macro_call even for attributes)

I changed the handling of disabled attribute macro expansion to
immediately ignore the macro and report an unresolved_proc_macro,
because otherwise they would now result in loud unresolved_macro_call
errors. I hope this doesn't break anything.

Also try to improve error ranges for unresolved_macro_call / macro_error
by reusing the code for unresolved_proc_macro. It's not perfect but
probably better than before.
2022-06-24 13:45:19 +02:00
Lukas Wirth
2642f64570 internal: Simplify 2022-06-23 20:08:29 +02:00
Lukas Wirth
013c6a3f75 fix: attribute macros not being properly diagnosed 2022-06-19 00:37:37 +02:00
bors
7ade4d49fc Auto merge of #12517 - xuhongxu96:master, r=Veykril
fix methods in pub trait generated by macro cannot be completed

Fix #12483

Check if the container is trait and inherit the visibility to associate items during collection.
2022-06-16 09:14:09 +00:00
Lukas Wirth
0e41d15b82 Use the correct crates proc-macro loading error message 2022-06-15 18:06:33 +02:00
Lukas Wirth
1d34cdcac0 Diagnose unresolved attribute proc-macros 2022-06-15 17:34:13 +02:00
Lukas Wirth
7d51fc4640 Show proc-macro loading errors in unresolved-proc-macro diagnostics 2022-06-15 17:34:01 +02:00
Hongxu Xu
549c810436 revert hir-def lib.rs 2022-06-15 07:48:34 +08:00
Hongxu Xu
8805a768d4 check if the container is trait and inherit the visibility 2022-06-15 07:47:06 +08:00
Hongxu Xu
070456838d remove inherit_visibility test case in item_tree 2022-06-14 23:24:48 +08:00
Hongxu Xu
ded412d56b implement inherited_visibility in collector 2022-06-14 23:23:15 +08:00
Hongxu Xu
3f60e71a12 remove inherited_visibility in lower.rs 2022-06-14 21:44:07 +08:00
bors
4f2a67b26f Auto merge of #12513 - Veykril:ty-utils, r=Veykril
internal: Simplify `hir_ty::utils`
2022-06-12 14:08:08 +00:00
Lukas Wirth
9153f17382 internal: Simplify hir_ty::utils 2022-06-12 16:07:08 +02:00
bors
d513f657a3 Auto merge of #12509 - Veykril:ty-utils, r=Veykril
internal: Remove `Generics::type_iter` in favor of `Generics::iter`
2022-06-12 12:40:57 +00:00
Lukas Wirth
7a0ab1358c internal: Remove Generics::type_iter in favor of Generics::iter 2022-06-12 14:40:37 +02:00
Lukas Wirth
76ae5434fa internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
Lukas Wirth
0cf677ab42 internal: Update dashmap and freeze its version 2022-06-10 16:19:52 +02:00
Tim Neumann
40bfb29e50 feat: Support $$ in macros.
The implementation mirrors what `rustc` currently does [1]. Part of #11952.

[1]: 0595ea1d12/compiler/rustc_expand/src/mbe/quoted.rs (L230-L241)
2022-06-02 21:48:28 +02:00
Ryo Yoshida
c1c867506b
Add Expr::Underscore 2022-06-01 01:21:57 +09:00
feniljain
25f3e7a33c fix: float display impl 2022-05-31 10:13:03 +05:30
bors
bd06902f90 Auto merge of #12395 - feniljain:fix_bugs, r=Veykril
fix: f32 and f64 representation during lowering

should fix #12380
2022-05-27 12:44:08 +00:00
feniljain
1f4870ff1c fix: f32 and f64 representation during lowering 2022-05-26 20:03:05 +05:30
Lukas Wirth
7913ae69b9 internal: Remove Interned usage from nameres collector 2022-05-26 12:59:57 +02:00
bors
2a978e1404 Auto merge of #12328 - Veykril:simplify, r=Veykril
minor: Simplify
2022-05-20 15:03:59 +00:00
Lukas Wirth
88e297e47d minor: Simplify 2022-05-20 16:52:10 +02:00
Jonas Schievink
60a2ab4c67 Rename Expr::Lambda to Expr::Closure 2022-05-20 15:40:32 +02:00
Aleksey Kladov
57cb65bb7a internal: vendor lsp-server 2022-05-14 21:15:43 +01:00
Jonas Schievink
0831f3123b Fix tests 2022-05-13 15:54:46 +02:00
Jonas Schievink
9bd11459ba Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"
This reverts commit cc9ae2b89e, reversing
changes made to 7dfd1cb572.
2022-05-13 15:08:14 +02:00
Jonas Schievink
2287ae22c6 Revert "Skip only the tt::Literal when consuming float tokens"
This reverts commit 7db55313a1.
2022-05-13 15:06:16 +02:00
Jonas Schievink
bde036b74e Revert "Fix conversion of float literals in TtTreeSink"
This reverts commit 43a066c5a8.
2022-05-13 15:05:34 +02:00
Jonas Schievink
73e0e17b52 Revert "Don't remap float tokens to INT_NUMBER"
This reverts commit cb5e8da88a.
2022-05-13 15:04:36 +02:00
Jonas Schievink
cb5e8da88a Don't remap float tokens to INT_NUMBER 2022-05-12 19:01:09 +02:00
Lukas Wirth
4b505ce0f9 internal: Add token mapping test for float literals 2022-05-12 13:17:53 +02:00
bors
3d2d209638 Auto merge of #11983 - jhpratt:remove-rustc_deprecated, r=lnicola
Remove handling of `#[rustc_deprecated]`

This should be merged along with rust-lang/rust#95960.

Because the attribute still exists in rustc, I've left the definition here. With that said, any use of it is an error, so I've removed any handling of `#[rustc_deprecated]`.
2022-05-09 08:33:18 +00:00
Jonas Schievink
43a066c5a8 Fix conversion of float literals in TtTreeSink 2022-05-06 18:39:06 +02:00
Jonas Schievink
7db55313a1 Skip only the tt::Literal when consuming float tokens 2022-05-06 16:10:54 +02:00
Jonas Schievink
502c519e7d Wrap float literals in their own node 2022-05-05 16:28:14 +02:00
Laurențiu Nicola
9856144b0b Lower values of char and byte literals 2022-05-05 08:12:08 +03:00
rainy-me
ddff1b22f9 fix: add docs and remove unnecessary check 2022-05-05 13:41:33 +09:00
Jacob Pratt
3c376e5be8
Remove handling of #[rustc_deprecated] 2022-05-04 22:25:58 -04:00
rainy-me
5f4351fbb6 fix: doc url link type 2022-05-05 00:41:29 +09:00
Peh
1f011fa4a3 style: rename crates to kebab case 2022-05-01 10:48:58 +00:00