Commit Graph

15596 Commits

Author SHA1 Message Date
Nicholas Nethercote
888c18d3f3 Rename many interner functions.
(This is a large commit. The changes to
`compiler/rustc_middle/src/ty/context.rs` are the most important ones.)

The current naming scheme is a mess, with a mix of `_intern_`, `intern_`
and `mk_` prefixes, with little consistency. In particular, in many
cases it's easy to use an iterator interner when a (preferable) slice
interner is available.

The guiding principles of the new naming system:
- No `_intern_` prefixes.
- The `intern_` prefix is for internal operations.
- The `mk_` prefix is for external operations.
- For cases where there is a slice interner and an iterator interner,
  the former is `mk_foo` and the latter is `mk_foo_from_iter`.

Also, `slice_interners!` and `direct_interners!` can now be `pub` or
non-`pub`, which helps enforce the internal/external operations
division.

It's not perfect, but I think it's a clear improvement.

The following lists show everything that was renamed.

slice_interners
- const_list
  - mk_const_list -> mk_const_list_from_iter
  - intern_const_list -> mk_const_list
- substs
  - mk_substs -> mk_substs_from_iter
  - intern_substs -> mk_substs
  - check_substs -> check_and_mk_substs (this is a weird one)
- canonical_var_infos
  - intern_canonical_var_infos -> mk_canonical_var_infos
- poly_existential_predicates
  - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter
  - intern_poly_existential_predicates -> mk_poly_existential_predicates
  - _intern_poly_existential_predicates -> intern_poly_existential_predicates
- predicates
  - mk_predicates -> mk_predicates_from_iter
  - intern_predicates -> mk_predicates
  - _intern_predicates -> intern_predicates
- projs
  - intern_projs -> mk_projs
- place_elems
  - mk_place_elems -> mk_place_elems_from_iter
  - intern_place_elems -> mk_place_elems
- bound_variable_kinds
  - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter
  - intern_bound_variable_kinds -> mk_bound_variable_kinds

direct_interners
- region
  - intern_region (unchanged)
- const
  - mk_const_internal -> intern_const
- const_allocation
  - intern_const_alloc -> mk_const_alloc
- layout
  - intern_layout -> mk_layout
- adt_def
  - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid)
  - alloc_adt_def(!) -> mk_adt_def
- external_constraints
  - intern_external_constraints -> mk_external_constraints

Other
- type_list
  - mk_type_list -> mk_type_list_from_iter
  - intern_type_list -> mk_type_list
- tup
  - mk_tup -> mk_tup_from_iter
  - intern_tup -> mk_tup
2023-02-24 07:32:24 +11:00
Laurențiu Nicola
7e711da2f0 ⬆️ rust-analyzer 2023-02-20 10:14:12 +02:00
Laurențiu Nicola
bc45c7659a ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
Albert Larsan
3e0e51c108 Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
arcnmx
25242fe93f ⬆️ rust-analyzer
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2023-01-09 10:36:22 -08:00
Laurențiu Nicola
a2a1d99545 ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00
Michael Goulet
61c744d4fd Rollup merge of #104211 - lnicola:rust-analyzer-2022-11-09, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2022-11-09 21:53:38 -08:00
Laurențiu Nicola
79923c382a ⬆️ rust-analyzer 2022-11-09 21:49:10 +02:00
Dylan DPC
a65ca91b84 Rollup merge of #103919 - nnethercote:unescaping-cleanups, r=matklad
Unescaping cleanups

Some code improvements, and some error message improvements.

Best reviewed one commit at a time.

r? ````@matklad````
2022-11-09 19:21:22 +05:30
Nicholas Nethercote
7d2a1ee4fc Remove unescape_byte_literal.
It's easy to just use `unescape_literal` + `byte_from_char`.
2022-11-05 13:56:36 +11:00
Laurențiu Nicola
c60b1f6414 ⬆️ rust-analyzer 2022-11-01 11:31:31 +02:00
Laurențiu Nicola
8807fc4cc3 ⬆️ rust-analyzer 2022-10-26 17:40:41 +03:00
Laurențiu Nicola
a99a48e786 ⬆️ rust-analyzer 2022-10-18 09:12:49 +03:00
Ralf Jung
8536eb016c rename rustc_allocator_nounwind to rustc_nounwind 2022-10-11 22:47:31 +02:00
Laurențiu Nicola
4f55ebbd4f ⬆️ rust-analyzer 2022-10-11 10:37:35 +03:00
Petr Portnov
ed532e5a34 Fix duplicate usage of a article.
This fixes a typo first appearing in #94624
in which test-macro diagnostic uses "a" article twice.

Since I searched sources for " a a " sequences,
I also fixed the same issue in a few source files where I found it.

Signed-off-by: Petr Portnov <gh@progrm-jarvis.ru>
2022-10-02 21:40:39 +03:00
lcnr
6f13f12301 rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00
Laurențiu Nicola
f5fde4df43 ⬆️ rust-analyzer 2022-09-20 17:39:17 +03:00
Laurențiu Nicola
459bbb4222 ⬆️ rust-analyzer 2022-09-13 15:38:11 +03:00
Laurențiu Nicola
65e1dc4d9c ⬆️ rust-analyzer 2022-09-06 21:20:49 +03:00
bors
c1918fcb9a Auto merge of #100210 - mystor:proc_macro_diag_struct, r=eddyb
proc_macro/bridge: send diagnostics over the bridge as a struct

This removes some RPC when creating and emitting diagnostics, and
simplifies the bridge slightly.

After this change, there are no remaining methods which take advantage
of the support for `&mut` references to objects in the store as
arguments, meaning that support for them could technically be removed if
we wanted. The only remaining uses of immutable references into the
store are `TokenStream` and `SourceFile`.

r? `@eddyb`
2022-09-01 00:26:53 +00:00
Laurențiu Nicola
3e358a6827 ⬆️ rust-analyzer 2022-08-30 14:51:24 +03:00
Laurențiu Nicola
31519bb394 ⬆️ rust-analyzer 2022-08-23 10:05:52 +03:00
Laurențiu Nicola
8231fee466 ⬆️ rust-analyzer 2022-08-16 11:24:50 +03:00
Laurențiu Nicola
22c8c9c401 ⬆️ rust-analyzer 2022-08-09 07:23:57 +03:00
Nika Layzell
2c7f2c105b proc_macro/bridge: send diagnostics over the bridge as a struct
This removes some RPC when creating and emitting diagnostics, and
simplifies the bridge slightly.

After this change, there are no remaining methods which take advantage
of the support for `&mut` references to objects in the store as
arguments, meaning that support for them could technically be removed if
we wanted. The only remaining uses of immutable references into the
store are `TokenStream` and `SourceFile`.
2022-08-06 15:49:43 -04:00
Laurențiu Nicola
9d2cb42a41 ⬆️ rust-analyzer 2022-08-02 09:05:16 +03:00
Amos Wenger
a1f1b95d00 Merge commit 'e36a20c24f35a4cee82bbdc600289104c9237c22' into ra-sync-and-pms-component 2022-07-26 11:53:50 +02:00
Amos Wenger
dfe84494c1 Make macros test order-resistant 2022-07-24 16:48:06 +02:00
Amos Wenger
56c369db48 Sort when iterating through CrateGraph 2022-07-24 16:11:05 +02:00
Amos Wenger
d8c0d88e4f Sort in DefMap::dump, since HashMap iteration order isn't defined 2022-07-24 16:04:20 +02:00
Amos Wenger
ff317858c1 hir-def tests: sort results before comparing, since FxHashSet iteration order isn't guaranteed
(And, in fact, it failed on i686)
2022-07-24 15:55:26 +02:00
Amos Wenger
74998e46e9 Fix .gitattributes for test_data 2022-07-24 14:05:35 +02:00
Joshua Nelson
20eb2ddb2e Small fixups
- use `path` instead of `paths`
- don't mark rust-analyzer as an optional tool
- print the cargo command that's run in the proc-macro-test build script

  this originally was part of a change to fix `test --stage 0 rust-analyzer`,
  but I'm going to leave that for a separate PR so it's easier to review.
2022-07-24 10:38:42 +02:00
Amos Wenger
b351e115d6 Move cfg attrs up to the mod definitions to disable sourcegen 2022-07-24 10:38:34 +02:00
Amos Wenger
0bffdf2627 Disable all source-gen tests at compile time 2022-07-24 10:38:28 +02:00
Amos Wenger
5f3f4284dd Don't run slow tests in Rust CI, only RA CI 2022-07-24 10:38:19 +02:00
Aleksey Kladov
5bd84432dd internal: extract common code for adjusting diagnostic range 2022-07-23 22:24:44 +01:00
Aleksey Kladov
a436be44b2 feat: don't highlight the whole fn on return-type mismatch 2022-07-23 21:16:59 +01:00
bors
2be00623e4 Auto merge of #12851 - DorianListens:dscheidt/if-completion-match-guard, r=Veykril
fix: Don't add braces to 'if' completion in match guard position

fixes #12823

Is this what you were thinking of here, `@Veykril` ? I haven't done any work on completions before, so I could definitely be misunderstanding the issue.
2022-07-23 17:42:59 +00:00
Dorian Scheidt
13c83f90ac fix: Don't add braces to 'if' completion in match guard position
When the cursor is in a match arm, but before the fat arrow (=>) token, don't
add braces when autocompleting "if".

fixes #12823
2022-07-23 12:25:02 -05:00
Ralf Jung
ff041bfa68 fix generate_new doc 2022-07-23 11:09:01 -04:00
bors
0b131bc78e Auto merge of #12849 - Veykril:no-parse, r=Veykril
internal: Don't parse files unnecessarily in scope_for_offset
2022-07-22 23:00:35 +00:00
Lukas Wirth
cb6703fe06 internal: Don't parse files unnecessarily in scope_for_offset 2022-07-23 00:50:59 +02:00
bors
d469e0de9a Auto merge of #12840 - Veykril:be-lazy, r=Veykril
internal: Use ItemTree for variant, field and module attribute collection in attrs_query

Less parsing = very good, should speed up lang item collection as that basically probes attributes of all enum variants which currently triggers parsing

Not fond of how this is searching for the correct index, ideally we'd map between HIR and item tree Id here but I am not sure how, storing the item tree ids in the HIR version doesn't work due to the usage of `Trace`...
2022-07-22 20:35:31 +00:00
Lukas Wirth
0081ef3834 Use ItemTree for modules in attrs_query 2022-07-22 22:17:13 +02:00
bors
7e30ca1f2a Auto merge of #12844 - Veykril:highlight-attr, r=Veykril
fix: Improve syntax highlighting in attributes

Fixes https://github.com/rust-lang/rust-analyzer/issues/12842
2022-07-22 15:31:32 +00:00
Lukas Wirth
1ab862a628 fix: Improve syntax highlighting in attributes 2022-07-22 17:29:03 +02:00
bors
cb8a3be2a1 Auto merge of #12835 - fasterthanlime:sysroot-abi, r=fasterthanlime
Introduce proc-macro-srv/sysroot-abi

Still a WIP.

This change is tracked by:

  * https://github.com/rust-lang/rust-analyzer/issues/12818
2022-07-22 12:28:27 +00:00
Amos Wenger
e591ff3269 Add comment about replacing crossbeam with std scoped threads when they land 2022-07-22 14:23:36 +02:00