Commit Graph

858 Commits

Author SHA1 Message Date
Nicholas Nethercote
bcf0ec0191 Replace mk_foo calls with infer_foo where possible.
There are several `mk_foo`/`intern_foo` pairs, where the former takes an
iterator and the latter takes a slice. (This naming convention is bad,
but that's a fix for another PR.)

This commit changes several `mk_foo` occurrences into `intern_foo`,
avoiding the need for some `.iter()`/`.into_iter()` calls. Affected
cases:
- mk_type_list
- mk_tup
- mk_substs
- mk_const_list
2023-02-17 22:24:31 +11:00
bors
9556b56dbd Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwU
Switch to `EarlyBinder` for `type_of` query

Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78.

Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`.

r? `@lcnr`
2023-02-17 04:45:15 +00:00
bors
ea218392a4 Auto merge of #108145 - matthiaskrgr:rollup-bgadak1, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104068 (rustdoc: Add PartialOrd trait to doc comment explanation)
 - #107489 (Implement partial support for non-lifetime binders)
 - #107905 (Pass arguments to `x` subcommands with `--`)
 - #108009 (Move some tests)
 - #108086 (wasm: Register the `relaxed-simd` target feature)
 - #108104 (don't into self)
 - #108133 (Small cleanups around `EarlyBinder`)
 - #108136 (Do not ICE on unmet trait alias impl bounds)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-17 01:14:39 +00:00
Kyle Matsuda
c183110cc2 remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
Kyle Matsuda
d822b97a27 change usages of type_of to bound_type_of 2023-02-16 17:01:52 -07:00
Matthias Krüger
e1e58fc1d3
Rollup merge of #108133 - kylematsuda:earlybinder-cleanups, r=compiler-errors
Small cleanups around `EarlyBinder`

Cleaning up a few things that were brought up by `@lcnr` in reviewing #106696:

- [make `issue33140_self_ty` query return `Option<EarlyBinder<Ty>>`](https://github.com/rust-lang/rust/pull/106696#discussion_r1067821423)
- [small style improvement](https://github.com/rust-lang/rust/pull/106696#discussion_r1067816772)
2023-02-17 00:19:37 +01:00
Kyle Matsuda
382ade6a60 fix ugly skip_binder 2023-02-16 10:52:57 -07:00
John Kåre Alsaker
a51a20531d Factor query arena allocation out from query caches 2023-02-16 14:54:53 +01:00
Michael Goulet
eff2cb7760 Rename some region-specific stuff 2023-02-16 03:39:59 +00:00
Camille GILLOT
03dff82d59 Add of_trait to DefKind::Impl. 2023-02-14 19:55:44 +00:00
Vadim Petrochenkov
fd73d01c98 rustc_resolve: Remove Resolver::clone_output
And remove `Clone` impls and `Lrc`s that are no longer necessary
2023-02-13 00:10:15 +04:00
Vadim Petrochenkov
9080b79f2b rustdoc: Eliminate remaining uses of resolver 2023-02-13 00:10:15 +04:00
bors
51cb5614dd Auto merge of #105601 - BelovDV:change-rlib-with-not-stable, r=petrochenkov
Enable new rlib in non stable cases

If bundled static library uses cfg (unstable) or whole-archive (wasn't supported) bundled libs are packed even without packed_bundled_libs.

r? `@petrochenkov`
2023-02-12 07:15:27 +00:00
Daniil Belov
601fc8b36b [link] enable packed bundled lib in non stable cases 2023-02-10 12:51:12 +03:00
Vadim Petrochenkov
b62b82aef4 Resolve documentation links in rustc and store the results in metadata
This commit implements MCP https://github.com/rust-lang/compiler-team/issues/584

It also removes code that is no longer used, and that includes code cloning resolver, so issue #83761 is fixed.
2023-02-10 09:34:13 +04:00
Matthias Krüger
6d225bb080
Rollup merge of #100599 - MatthewPeterKelly:add-E0523-description-and-test, r=compiler-errors,GuillaumeGomez
Add compiler error E0523 long description and test

This PR is one step towards addressing:  https://github.com/rust-lang/rust/issues/61137.
2023-02-07 17:57:13 +01:00
Matthew Kelly
2bcd4e256a Add extended error message for E0523
Adds the extended error documentation for E0523 to indicate that the
error is no longer produced by the compiler.

Update the E0464 documentation to include example code that produces the
error.

Remove the error message E0523 from the compiler and replace it with an
internal compiler error.
2023-02-06 06:58:30 -05:00
Vadim Petrochenkov
f4e2b954a1 rustc_metadata: Encode/decode DefPathHashes without an Option 2023-02-05 18:53:47 +04:00
Vadim Petrochenkov
c60cc43985 rustc_metadata: Encode/decode some LazyArrays without an Option
Also add asserts to decoding `LazyArray`s with `Option`
2023-02-05 18:19:52 +04:00
Vadim Petrochenkov
eb5f2d3980 rustc_metadata: Support encoding/decoding LazyArray without an Option 2023-02-05 18:19:52 +04:00
Vadim Petrochenkov
8cc5aa561c rustc_metadata: Refactor lazy table reading/writing
Change wording from "nullable" to "default".
Introduce a trait `IsDefault` for detecting values that are encoded as zeros or not encoded at all.
Add panics to impossible cases.
Some other minor cleanups.
2023-02-05 18:19:52 +04:00
est31
4442f13b03 rustc_metadata: remove huge error imports 2023-02-05 03:47:38 +01:00
Michael Woerister
227b2858da Retry opening proc-macro DLLs a few times on Windows. 2023-02-02 16:18:16 +01:00
Guillaume Gomez
53bb6322db
Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obk
Improve enum checks

Some light refactoring.
2023-01-31 23:38:52 +01:00
Maybe Waffle
f1d273cbfb Replace some _ == _ || _ == _s with matches!(_, _ | _)s 2023-01-30 12:26:26 +00:00
Maybe Waffle
fd649a3cc5 Replace enum ==s with matches where it makes sense 2023-01-30 12:26:26 +00:00
Camille GILLOT
1d3f5b49d6 Test drop_tracking_mir before querying generator. 2023-01-29 13:50:07 +00:00
bors
bcb064a7f4 Auto merge of #107406 - cjgillot:eliminate-witnesses, r=compiler-errors
Only compute mir_generator_witnesses query in drop_tracking_mir mode.

Attempt to fix the perf regression in https://github.com/rust-lang/rust/pull/101692

r? `@ghost`
2023-01-29 01:27:11 +00:00
Camille GILLOT
15d6325747 Remove HirId -> LocalDefId map from HIR. 2023-01-28 09:55:26 +00:00
Camille GILLOT
4db4860503 Only compute mir_generator_witnesses query in drop_tracking_mir mode. 2023-01-28 08:41:22 +00:00
Camille GILLOT
400cb9aa41 Separate witness type computation from the generator transform. 2023-01-27 19:00:26 +00:00
bors
7919ef0ec5 Auto merge of #107055 - kylematsuda:eb-fn-sig, r=lcnr
Switch to `EarlyBinder` for `fn_sig` query

Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78).

Several queries `X` have a `bound_X` variant that wraps the output in [`EarlyBinder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.EarlyBinder.html). This adds `EarlyBinder` to the return type of the `fn_sig` query and removes `bound_fn_sig`.

r? `@lcnr`
2023-01-27 15:02:44 +00:00
bors
6874f4e3fc Auto merge of #107054 - petrochenkov:effvisdoc3, r=GuillaumeGomez
rustdoc: Collect "rustdoc-reachable" items during early doc link resolution

This pass only needs to know about visibilities, attributes and reexports, so it can be run early, similarly to `compute_effective_visibilities` in rustc.
Results of this pass can be used to prune the list of extern impls early thus improving performance of https://github.com/rust-lang/rust/pull/94857.
2023-01-27 09:01:05 +00:00
Yuki Okushi
eb5e63e3f0
Rollup merge of #107171 - petrochenkov:encattrs, r=cjgillot
rustc_metadata: Fix `encode_attrs`

This function didn't do what the authors intended it to do.

- Due to `move` in the closure `is_public` wasn't captured by mutalbe reference and wasn't used as a cache.
- Due to iterator cloning all the `should_encode_attr` logic run for the second time to calculate `may_have_doc_links`

This PR fixes these issues, and calculates all the needed attribute flags in one go.

(Noticed while implementing https://github.com/rust-lang/rust/pull/107136.)
2023-01-27 12:57:54 +09:00
Kyle Matsuda
c2414dfaa4 change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add EarlyBinder to fn_sig in metadata 2023-01-26 20:28:25 -07:00
Kyle Matsuda
e982971ff2 replace usages of fn_sig query with bound_fn_sig 2023-01-26 20:15:36 -07:00
Matthias Krüger
82455a799e
Rollup merge of #107189 - cjgillot:meta-adt, r=compiler-errors
Encode info for Adt in a single place.

Split from https://github.com/rust-lang/rust/pull/98867
2023-01-26 15:02:21 +01:00
Vadim Petrochenkov
957bc606dd rustdoc: Collect rustdoc-reachable items during early doc link resolution 2023-01-25 23:14:09 +04:00
Vadim Petrochenkov
c70b7aafae rustc_metadata: Fix encode_attrs
This function didn't do what the authors intended it to do.

- Due to `move` in the closure `is_public` wasn't captured by mutalbe reference and wasn't used as a cache.
- Due to iterator cloning all the `should_encode_attr` logic run for the second time to calculate `may_have_doc_links`

This PR fixes these issues, and calculates all the needed attribute flags in one go.
2023-01-25 10:08:48 +04:00
Vadim Petrochenkov
91fdbd7343 rustc_metadata: Support non-Option nullable values in metadata tables
This is a convenience feature for cases in which "no value in the table" and "default value in the table" are equivalent.
Tables using `Table<DefIndex, ()>` are migrated in this PR, some other cases can be migrated later.

This helps `DocFlags` in https://github.com/rust-lang/rust/pull/107136 in particular.
2023-01-23 19:35:03 +04:00
Camille GILLOT
4d11206ee7 Tweak comments. 2023-01-22 11:13:19 +00:00
Camille GILLOT
6ecf30d67d Inline encode_enum_variant_info. 2023-01-22 11:04:53 +00:00
Camille GILLOT
d7f6564fdd Encode AdtDef in the def-id loop. 2023-01-22 11:04:52 +00:00
Vadim Petrochenkov
415c14129b rustc_metadata: Encode doc(hidden) flag to metadata
To retrieve these flags rustdoc currently has to mass decode full attributes for items in the whole crate tree, so it's better to pre-compute it in advance.

This is especially for short-term performance of https://github.com/rust-lang/rust/pull/107054 because resolver cannot use memoization of query results yet.
2023-01-21 22:35:20 +04:00
bors
005fc0f00f Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obk
Use UnordMap and UnordSet for id collections (DefIdMap, LocalDefIdMap, etc)

This PR changes the `rustc_data_structures::define_id_collections!` macro to use `UnordMap` and `UnordSet` instead of `FxHashMap` and `FxHashSet`. This should account for a large portion of hash-maps being used in places where they can cause trouble.

The changes required are moderate but non-zero:
- In some places the collections are extracted into sorted vecs.
- There are a few instances where for-loops have been changed to extends.

~~Let's see what the performance impact is. With a bit more refactoring, we might be able to get rid of some of the additional sorting -- but the change set is already big enough. Unless there's a performance impact, I'd like to do further changes in subsequent PRs.~~

Performance does not seem to be negatively affected ([perf-run here](https://github.com/rust-lang/rust/pull/106977#issuecomment-1396776699)).

Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).

r? `@ghost`
2023-01-21 14:18:17 +00:00
Michael Goulet
7e0b1f1115 Conditionally encode boolean 2023-01-19 16:09:10 +00:00
Michael Goulet
200f466d1a Encode whether foreign opaques are TAITs or not 2023-01-19 15:45:49 +00:00
Michael Woerister
72ee14ce39 Allow for more efficient sorting when exporting Unord collections. 2023-01-19 10:40:54 +01:00
Michael Woerister
c3d2573120 Use UnordMap instead of FxHashMap in define_id_collections!(). 2023-01-19 10:40:47 +01:00
Michael Goulet
a637e2a950
Rollup merge of #106917 - compiler-errors:const-closure-foreign, r=tmiasko
Encode const mir for closures if they're const

Fixes #106913
2023-01-18 18:00:29 -05:00