summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
AgeCommit message (Collapse)AuthorLines
2023-03-03Match unmatched backticks in comments in compiler/est31-1/+1
2023-03-01Properly implement should_encode_fn_impl_trait_in_trait using new unstable ↵Santiago Pastorino-3/+12
option
2023-02-28Descriptive error when users try to combine RPITIT/AFIT with specializationMichael Goulet-29/+1
2023-02-25Rollup merge of #107675 - jsgf:link-directives, r=davidtwcoMichael Goulet-1/+6
Implement -Zlink-directives=yes/no `-Zlink-directives=no` will ignored `#[link]` directives while compiling a crate, so nothing is emitted into the crate's metadata. The assumption is that the build system already knows about the crate's native dependencies and can provide them at link time without these directives. This is another way to address issue # #70093, which is currently addressed by `-Zlink-native-libraries` (implemented in #70095). The latter is implemented at link time, which has the effect of ignoring `#[link]` in *every* crate. This makes it a very large hammer as it requires all native dependencies to be known to the build system to be at all usable, including those in sysroot libraries. I think this means its effectively unused, and definitely under-used. Being able to control this on a crate-by-crate basis should make it much easier to apply when needed. I'm not sure if we need both mechanisms, but we can decide that later. cc `@pcwalton` `@cramertj`
2023-02-24Rename many interner functions.Nicholas Nethercote-2/+2
(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-22Implement -Zlink-directives=yes/noJeremy Fitzhardinge-1/+6
`-Zlink-directives=no` will ignored `#[link]` directives while compiling a crate, so nothing is emitted into the crate's metadata. The assumption is that the build system already knows about the crate's native dependencies and can provide them at link time without these directives. This is another way to address issue # #70093, which is currently addressed by `-Zlink-native-libraries` (implemented in #70095). The latter is implemented at link time, which has the effect of ignoring `#[link]` in *every* crate. This makes it a very large hammer as it requires all native dependencies to be known to the build system to be at all usable, including those in sysroot libraries. I think this means its effectively unused, and definitely under-used. Being able to control this on a crate-by-crate basis should make it much easier to apply when needed. I'm not sure if we need both mechanisms, but we can decide that later.
2023-02-22errors: generate typed identifiers in each crateDavid Wood-11/+16
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-21Rollup merge of #108141 - spastorino:add_rpitit_queries, r=compiler-errorsDylan DPC-2/+14
Add rpitit queries This is part of the changes we are making to lower RPITITs as an associated type. The rest of the stuff will follow under a `-Z` flag. I still need to add comments to the code, explain stuff and also I'd need to avoid encoding in metadata when rpitit queries return `&[]` r? `@compiler-errors`
2023-02-20Stop passing in values that one can also get from the tcx lazilyOli Scherer-12/+17
2023-02-20Remove definitions field that is only needed for one methodOli Scherer-12/+4
2023-02-20Make untracked.cstore lockable so that resolution can still write to it when ↵Oli Scherer-7/+12
using TyCtxt
2023-02-19Add associated_items_for_impl_trait_in_trait querySantiago Pastorino-0/+12
2023-02-17Make encode_attrs use opt_local_def_id_to_hir_id so we can feed it with None ↵Santiago Pastorino-2/+2
for definitions that have no HIR
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-1/+1
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-17Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwUbors-1/+2
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-17Auto merge of #108145 - matthiaskrgr:rollup-bgadak1, r=matthiaskrgrbors-2/+3
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-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-2/+2
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+2
2023-02-17Rollup merge of #108133 - kylematsuda:earlybinder-cleanups, r=compiler-errorsMatthias Krüger-1/+2
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-16fix ugly skip_binderKyle Matsuda-1/+2
2023-02-16Factor query arena allocation out from query cachesJohn Kåre Alsaker-1/+1
2023-02-16Rename some region-specific stuffMichael Goulet-1/+1
2023-02-14Add `of_trait` to DefKind::Impl.Camille GILLOT-9/+10
2023-02-13rustc_resolve: Remove `Resolver::clone_output`Vadim Petrochenkov-6/+5
And remove `Clone` impls and `Lrc`s that are no longer necessary
2023-02-13rustdoc: Eliminate remaining uses of resolverVadim Petrochenkov-23/+20
2023-02-12Auto merge of #105601 - BelovDV:change-rlib-with-not-stable, r=petrochenkovbors-13/+14
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-10[link] enable packed bundled lib in non stable casesDaniil Belov-13/+14
2023-02-10Resolve documentation links in rustc and store the results in metadataVadim Petrochenkov-65/+54
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-07Rollup merge of #100599 - MatthewPeterKelly:add-E0523-description-and-test, ↵Matthias Krüger-13/+6
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-06Add extended error message for E0523Matthew Kelly-13/+6
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-05rustc_metadata: Encode/decode `DefPathHash`es without an `Option`Vadim Petrochenkov-11/+14
2023-02-05rustc_metadata: Encode/decode some `LazyArray`s without an `Option`Vadim Petrochenkov-32/+39
Also add asserts to decoding `LazyArray`s with `Option`
2023-02-05rustc_metadata: Support encoding/decoding `LazyArray` without an `Option`Vadim Petrochenkov-30/+66
2023-02-05rustc_metadata: Refactor lazy table reading/writingVadim Petrochenkov-90/+127
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-05rustc_metadata: remove huge error importsest31-92/+89
2023-02-02Retry opening proc-macro DLLs a few times on Windows.Michael Woerister-2/+40
2023-01-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-33/+30
Improve enum checks Some light refactoring.
2023-01-30Replace some `_ == _ || _ == _`s with `matches!(_, _ | _)`sMaybe Waffle-1/+1
2023-01-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-32/+29
2023-01-29Test drop_tracking_mir before querying generator.Camille GILLOT-1/+1
2023-01-29Auto merge of #107406 - cjgillot:eliminate-witnesses, r=compiler-errorsbors-1/+1
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-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-2/+2
2023-01-28Only compute mir_generator_witnesses query in drop_tracking_mir mode.Camille GILLOT-1/+1
2023-01-27Separate witness type computation from the generator transform.Camille GILLOT-0/+6
2023-01-27Auto merge of #107055 - kylematsuda:eb-fn-sig, r=lcnrbors-3/+3
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-27Auto merge of #107054 - petrochenkov:effvisdoc3, r=GuillaumeGomezbors-0/+6
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-27Rollup merge of #107171 - petrochenkov:encattrs, r=cjgillotYuki Okushi-29/+48
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-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-3/+3
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-1/+1
2023-01-26Rollup merge of #107189 - cjgillot:meta-adt, r=compiler-errorsMatthias Krüger-113/+45
Encode info for Adt in a single place. Split from https://github.com/rust-lang/rust/pull/98867