about summary refs log tree commit diff
path: root/compiler/rustc_metadata
AgeCommit message (Collapse)AuthorLines
2023-03-21Eagerly intern and check CrateNum/StableCrateId collisionsOli Scherer-59/+25
2023-03-20Rollup merge of #109362 - nnethercote:split-meta-stats-items, r=bjorn3Matthias Krüger-4/+3
Split `items` from `-Zmeta-stats` in two. Because it's one of the biggest sections. r? `@bjorn3`
2023-03-20Update some names and commentsMichael Goulet-4/+4
2023-03-20Split `items` from `-Zmeta-stats` in two.Nicholas Nethercote-4/+3
Because it's one of the biggest sections.
2023-03-19Rollup merge of #109324 - cjgillot:fixed-unused-params, r=NilstriebDylan DPC-14/+29
Implement FixedSizeEncoding for UnusedGenericParams. Using a `Lazy` for actually a `u32` value is 50% overhead, so let's encode the bitset directly.
2023-03-19Rollup merge of #109243 - chenyukang:yukang/fix-ice-109144, r=petrochenkovDylan DPC-41/+35
The name of NativeLib will be presented Fixes #109144 I was working on a quick fix, but found change the name from `Option<Symbol>` to `Symbol` make life a little bit easier.
2023-03-19The name of NativeLib will be presentedyukang-41/+34
2023-03-18Implement FixedSizeEncoding for UnusedGenericParams.Camille GILLOT-14/+29
2023-03-17Rollup merge of #109198 - compiler-errors:new-rpitit-default-body, r=spastorinoMatthias Krüger-1/+1
Install projection from RPITIT to default trait method opaque correctly 1. For new lowering strategy `-Zlower-impl-trait-in-trait-to-assoc-ty`, install the correct default trait method projection predicates (RPITIT -> opaque). This makes default trait body tests pass! 2. Fix two WF-checking bugs -- first, we want to make sure that we're always looking for an opaque type in `check_return_position_impl_trait_in_trait_bounds`. That's because the RPITIT projections are normalized to opaques during wfcheck. Second, fix RPITIT's param-envs by not adding the projection predicates that we install on trait methods to make default RPITITs work -- I left a comment why. 3. Also, just a small drive-by for `rustc_on_unimplemented`. Not sure if it affects any tests, but can't hurt. r? ````@spastorino,```` based off of #109140
2023-03-17Do not ICE for native_lib without nameyukang-1/+2
2023-03-16Add `try_canonicalize` to `rustc_fs_util` and use it over `fs::canonicalize`John Kåre Alsaker-3/+5
2023-03-16resolve: Remove `item_attrs_untracked`Vadim Petrochenkov-8/+0
2023-03-16resolve: Remove `item_generics_num_lifetimes`Vadim Petrochenkov-8/+0
2023-03-15Rename impl_trait_in_trait_parent to impl_trait_in_trait_parent_fnSantiago Pastorino-1/+1
2023-03-15Rollup merge of #109109 - compiler-errors:polymorphize-foreign, r=NilstriebDylan DPC-1/+9
Use `unused_generic_params` from crate metadata Due to the way that `separate_provide_extern` interacted with the implementation of `<ty::InstanceDef<'tcx> as Key>::query_crate_is_local`, we actually never hit the foreign provider for `unused_generic_params`. Additionally, since the *local* provider of `unused_generic_params` calls `should_polymorphize`, which always returns false if the def-id is foreign, this means that we never actually polymorphize monomorphic instances originating from foreign crates. We don't actually encode `unused_generic_params` for items where all generics are used, so I had to tweak the foreign provider to fall back to `ty::UnusedGenericParams::new_all_used()` to avoid more ICEs when the above bugs were fixed.
2023-03-15Auto merge of #109089 - compiler-errors:opt_rpitit_info-follow-up, r=spastorinobors-2/+12
Encode `opt_rpitit_info` for associated types Follow-up, only last commit matters r? `@spastorino` This needs a perf run after the parent pr lands
2023-03-14Encode opt_rpitit_info for associated typesMichael Goulet-2/+12
2023-03-14Use `unused_generic_params` from crate metadataMichael Goulet-1/+9
2023-03-14Get impl defaultness using querySantiago Pastorino-2/+3
2023-03-14Auto merge of #109057 - compiler-errors:rpitit-info-again, r=spastorinobors-0/+2
Don't `opt_rpitit_info` as a separate query ... another attempt to undo regressions r? `@ghost`
2023-03-14Auto merge of #108992 - petrochenkov:qcstore2, r=cjgillotbors-70/+16
resolve: Querify most cstore access methods (subset) A subset of https://github.com/rust-lang/rust/pull/108346 that is not on a hot path in any way.
2023-03-13Don't opt_rpitit_info as a separate queryMichael Goulet-0/+2
2023-03-13Better names?Michael Goulet-2/+2
2023-03-13Treat projections with infer as placeholder during fast reject in new solverMichael Goulet-1/+2
2023-03-13metadata/resolve: Minor refactoring to "tcx -> cstore" conversionsVadim Petrochenkov-6/+9
2023-03-13metadata: Remove some more untracked `CStore` methodsVadim Petrochenkov-10/+4
2023-03-13resolve: Remove `struct_field_names_untracked`Vadim Petrochenkov-24/+1
2023-03-13resolve: Remove `fn_has_self_parameter_untracked`Vadim Petrochenkov-4/+0
2023-03-13resolve: Remove `struct_field_visibilities_untracked`Vadim Petrochenkov-22/+2
2023-03-13resolve: Remove `visibility_untracked`Vadim Petrochenkov-4/+0
2023-03-12Auto merge of #108820 - cjgillot:ensure-on-disk, r=oli-obkbors-3/+3
Ensure value is on the on-disk cache before returning from `ensure()`. The current logic for `ensure()` a query just checks that the node is green in the dependency graph. However, a lot of places use `ensure()` to prevent the query from being called later. This is the case before stealing a query result. If the query is actually green but the value is not available in the on-disk cache, `ensure` would return, but a subsequent call to the full query would run the code, and attempt to read from a stolen value. This PR conforms the query system to the usage by checking whether the queried value is loadable from disk before returning. Sadly, I can't manage to craft a proper test... Should fix all instances of "attempted to read from stolen value".
2023-03-12Auto merge of #109043 - matthiaskrgr:rollup-genkz0e, r=matthiaskrgrbors-5/+18
Rollup of 9 pull requests Successful merges: - #108726 (tidy: enforce comment blocks to have an even number of backticks) - #108797 (Allow binary files to go through the `FileLoader`) - #108841 (Add suggestion to diagnostic when user has array but trait wants slice. (rebased)) - #108984 (bootstrap: document tidy) - #109013 (Give proper error message when tcx wasn't passed to decoder) - #109017 (remove duplicated calls to sort_string) - #109018 (Expand on the allocator comment in `rustc-main`) - #109028 (Add eslint checks for rustdoc-js tester) - #109034 (Commit some tests for the new solver + lazy norm) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-12Rollup merge of #109013 - Nilstrieb:obscurity-is-not-a-necessity, r=fee1-deadMatthias Krüger-5/+18
Give proper error message when tcx wasn't passed to decoder I hit this yesterday and found it very confusing, even though the solution to the problem is very simple.
2023-03-12Auto merge of #108794 - nnethercote:avoid-unnecessary-hashing, r=cjgillotbors-23/+3
Avoid unnecessary hashing I noticed some stable hashing being done in a non-incremental build. It turns out that some of this is necessary to compute the crate hash, but some of it is not. Removing the unnecessary hashing is a perf win. r? `@cjgillot`
2023-03-12Auto merge of #108682 - est31:simplify_dirs, r=davidtwcobors-1/+1
Simplify message paths This makes it easier to open the messages file. Right now I have to first click on the `locales` dir to open it, and then on the `en-US.ftl` file. `Cargo.toml` and `build.rs` files are also in the top level, and I think there should not be more than one file, so a directory isn't really needed. The [chosen strategy for pontoon adoption](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/pontoon.20and.20next.20steps) is out of tree. Even if this descision is changed in the future, the `messages.ftl` approach is also compatible with non-english translations living in-tree, as long as the non-english translations don't live in the `compiler/rustc_foo/` directories but in different ones. That would also be helpful for grepability purposes. The commit was the result of automated changes: ``` for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done ``` r? `@davidtwco`
2023-03-11Use ensure_with_value in a few more places.Camille GILLOT-3/+3
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11Give proper error message when tcx wasn't passed to decoderNilstrieb-5/+18
2023-03-08Only compute the crate hash when necessary.Nicholas Nethercote-23/+3
The crate hash is needed: - if debug assertions are enabled, or - if incr. comp. is enabled, or - if metadata is being generated, or - if `-C instrumentation-coverage` is enabled. This commit avoids computing the crate hash when these conditions are all false, such as when doing a release build of a binary crate. It uses `Option` to store the hashes when needed, rather than computing them on demand, because some of them are needed in multiple places and computing them on demand would make compilation slower. The commit also removes `Owner::hash_without_bodies`. There is no benefit to pre-computing that one, it can just be done in the normal fashion.
2023-03-06Add tcx::lower_impl_trait_in_trait_to_assoc_ty to avoid accessing through ↵Santiago Pastorino-1/+1
sess.opts.unstable_opts
2023-03-05Auto merge of #101550 - CraftSpider:link-dead-windows, r=wesleywiserbors-5/+14
Make compressed rmeta contain compressed data length after header Fixes #90056, which is caused by link.exe introducing padding to the `.rustc` section, since it assumes this will have no effect besides allowing it to possibly use the extra space in future links.
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-28Update header commentRune Tynan-3/+3
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/+304
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`