]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #89514 - davidtwco:polymorphize-shims-and-predicates, r=lcnr
authorbors <bors@rust-lang.org>
Sun, 17 Oct 2021 12:33:12 +0000 (12:33 +0000)
committerbors <bors@rust-lang.org>
Sun, 17 Oct 2021 12:33:12 +0000 (12:33 +0000)
commit6f53ddfa74ac3c10ceb63ad4a7a9c95e55853c87
tree36083478c7109854fa324093166dd9d0f59fe4cf
parent1d6f24210c4a8f46f9781a56f819a383e590cccf
parentb39e915981a59fed6fba7bee727e603ddc1be4c4
Auto merge of #89514 - davidtwco:polymorphize-shims-and-predicates, r=lcnr

polymorphization: shims and predicates

Supersedes #75737 and #75414. This pull request includes up some changes to polymorphization which hadn't landed previously and gets stage2 bootstrapping and the test suite passing when polymorphization is enabled. There are still issues with `type_id` and polymorphization to investigate but this should get polymorphization in a reasonable state to work on.

- #75737 and #75414 both worked but were blocked on having the rest of the test suite pass (with polymorphization enabled) with and without the PRs. It makes more sense to just land these so that the changes are in.
- #75737's changes remove the restriction of `InstanceDef::Item` on polymorphization, so that shims can now be polymorphized. This won't have much of an effect until polymorphization's analysis is more advanced, but it doesn't hurt.
- #75414's changes remove all logic which marks parameters as used based on their presence in predicates - given #75675, this will enable more polymorphization and avoid the symbol clashes that predicate logic previously sidestepped.
- Polymorphization now explicitly checks (and skips) foreign items, this is necessary for stage2 bootstrapping to work when polymorphization is enabled.
- The conditional determining the emission of a note adding context to a post-monomorphization error has been modified. Polymorphization results in `optimized_mir` running for shims during collection where that wouldn't happen previously, some errors are emitted during `optimized_mir` and these were considered post-monomorphization errors with the existing logic (more errors and shims have a `DefId` coming from the std crate, not the local crate), adding a note that resulted in tests failing. It isn't particularly feasible to change where polymorphization runs or prevent it from using `optimized_mir`, so it seemed more reasonable to not change the conditional.
- `characteristic_def_id_of_type` was being invoked during partitioning for self types of impl blocks which had projections that depended on the value of unused generic parameters of a function - this caused a ICE in a debuginfo test. If partitioning is enabled and the instance needs substitution then this is skipped. That test still fails for me locally, but not with an ICE, but it fails in a fresh checkout too, so 🤷‍♂️.

r? `@lcnr`
compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
compiler/rustc_metadata/src/rmeta/encoder.rs
compiler/rustc_middle/src/mir/mono.rs
compiler/rustc_middle/src/query/mod.rs
compiler/rustc_monomorphize/src/collector.rs