about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
AgeCommit message (Collapse)AuthorLines
2023-03-31Auto merge of #109762 - scottmcm:variantdef-indexvec, r=WaffleLapkinbors-4/+5
Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>` And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-4/+5
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-30Auto merge of #109499 - spastorino:new-rpitit-19, r=compiler-errorsbors-16/+19
Give return-position impl traits in trait a (synthetic) name to avoid name collisions with new lowering strategy The only needed commit from this PR is the last one. r? `@compiler-errors` Needs #109455.
2023-03-29Walk return-position impl trait in trait deeply in associated_item_def_idsMichael Goulet-16/+19
2023-03-29Support TLS access into dylibs on WindowsJohn Kåre Alsaker-1/+11
2023-03-27Add a builtin `FnPtr` traitlcnr-1/+18
2023-03-25Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`Scott McMurray-7/+7
Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant. So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
2023-03-23Auto merge of #109503 - matthiaskrgr:rollup-cnp7kdd, r=matthiaskrgrbors-1/+1
Rollup of 9 pull requests Successful merges: - #108954 (rustdoc: handle generics better when matching notable traits) - #109203 (refactor/feat: refactor identifier parsing a bit) - #109213 (Eagerly intern and check CrateNum/StableCrateId collisions) - #109358 (rustc: Remove unused `Session` argument from some attribute functions) - #109359 (Update stdarch) - #109378 (Remove Ty::is_region_ptr) - #109423 (Use region-erased self type during IAT selection) - #109447 (new solver cleanup + implement coherence) - #109501 (make link clickable) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-22Rollup merge of #109378 - MU001999:master, r=scottmcmMatthias Krüger-1/+1
Remove Ty::is_region_ptr Fixes #109372
2023-03-22Auto merge of #109497 - matthiaskrgr:rollup-6txuxm0, r=matthiaskrgrbors-5/+3
Rollup of 10 pull requests Successful merges: - #109373 (Set LLVM `LLVM_UNREACHABLE_OPTIMIZE` to `OFF`) - #109392 (Custom MIR: Allow optional RET type annotation) - #109394 (adapt tests/codegen/vec-shrink-panik for LLVM 17) - #109412 (rustdoc: Add GUI test for "Auto-hide item contents for large items" setting) - #109452 (Ignore the vendor directory for tidy tests.) - #109457 (Remove comment about reusing rib allocations) - #109461 (rustdoc: remove redundant `.content` prefix from span/a colors) - #109477 (`HirId` to `LocalDefId` cleanup) - #109489 (More general captures) - #109494 (Do not feed param_env for RPITITs impl side) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23Rollup merge of #109405 - compiler-errors:rpitit-as-opaques, r=spastorinoDylan DPC-11/+13
RPITITs are `DefKind::Opaque` with new lowering strategy r? `@spastorino` Kinda cherry-picked #109400
2023-03-22Do not feed param_env for RPITITs impl sideSantiago Pastorino-5/+3
2023-03-22Auto merge of #109119 - lcnr:trait-system-cleanup, r=compiler-errorsbors-2/+1
a general type system cleanup removes the helper functions `traits::fully_solve_X` as they add more complexity then they are worth. It's confusing which of these helpers should be used in which context. changes the way we deal with overflow to always add depth in `evaluate_predicates_recursively`. It may make sense to actually fully transition to not have `recursion_depth` on obligations but that's probably a bit too much for this PR. also removes some other small - and imo unnecessary - helpers. r? types
2023-03-21RPITITs are DefKind::Opaque with new lowering strategyMichael Goulet-11/+13
2023-03-21IdentitySubsts::identity_for_item takes Into<DefId>Michael Goulet-1/+1
2023-03-21Use local key in providersMichael Goulet-24/+20
2023-03-21Rollup merge of #109240 - compiler-errors:dont-binder-twice, r=oli-obknils-16/+26
Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions Fixes a double subtraction in some binder math in return-position `impl Trait` in trait handling code. Fixes #109239
2023-03-21remove some trait solver helperslcnr-2/+1
they add more complexity then they are worth. It's confusing which of these helpers should be used in which context.
2023-03-20Rollup merge of #109277 - spastorino:new-rpitit-14, r=compiler-errorsMatthias Krüger-7/+3
Fix generics_of for impl's RPITIT synthesized associated type The only useful commit is the last one. This makes `generics_of` for the impl side RPITIT copy from the trait's associated type and avoid the fn on the impl side which was previously wrongly used. This solution is better but we still need to fix resolution of the generated generics. r? ``@compiler-errors``
2023-03-20Remove Ty::is_region_ptrMu42-1/+1
2023-03-20Update some names and commentsMichael Goulet-24/+37
2023-03-20Walk un-shifted nested `impl Trait` in trait when setting up default trait ↵Michael Goulet-16/+26
method assumptions
2023-03-17Fix generics_of for impl's RPITIT synthesized associated typeSantiago Pastorino-7/+3
2023-03-16Don't install default opaque projection predicates in RPITIT associated ↵Michael Goulet-7/+15
type's param-env
2023-03-16Install projection from RPITIT to default trait method opaque correctlyMichael Goulet-3/+14
2023-03-15Feed is_type_alias_impl_trait for RPITITs on the trait sideSantiago Pastorino-0/+2
2023-03-15ImplTraitPlaceholder -> is_impl_trait_in_traitSantiago Pastorino-1/+3
2023-03-15Properly implement generics_of for traitsSantiago Pastorino-2/+31
2023-03-15Rename impl_trait_in_trait_parent to impl_trait_in_trait_parent_fnSantiago Pastorino-2/+2
2023-03-15Auto merge of #109089 - compiler-errors:opt_rpitit_info-follow-up, r=spastorinobors-6/+3
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-6/+3
2023-03-14Rollup merge of #109101 - compiler-errors:layout-err, r=michaelwoeristerMatthias Krüger-1/+5
Fall back to old metadata computation when type references errors Projection is a bit too aggressive normalizing `<dyn Trait<[type error]> as Pointee>::Metadata` to `[type error]`, rather than to `DynMetadata<..>`. Side-step that by just falling back to the old structural metadata computation. Fixes #109078
2023-03-14Make fns from other crates with RPITIT workSantiago Pastorino-0/+6
2023-03-13Layout of `&dyn Trait<[type error]>` is still wideMichael Goulet-1/+5
2023-03-13Don't opt_rpitit_info as a separate queryMichael Goulet-11/+7
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-12Auto merge of #108700 - spastorino:new-rpitit-impl-side-2, r=compiler-errorsbors-13/+60
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty r? `@compiler-errors` It's probably best reviewed commit by commit.
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-08Auto merge of #108312 - michaelwoerister:hash-set-not-hash-stable, r=eholkbors-3/+2
Do not implement HashStable for HashSet (MCP 533) This PR removes all occurrences of `HashSet` in query results, replacing it either with `FxIndexSet` or with `UnordSet`, and then removes the `HashStable` implementation of `HashSet`. This is part of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), that is, removing the `HashStable` implementations of all collection types with unstable iteration order. The changes are mostly mechanical. The only place where additional sorting is happening is in Miri's override implementation of the `exported_symbols` query.
2023-03-07Rollup merge of #108583 - ↵Matthias Krüger-1/+24
compiler-errors:rpitit-default-method-with-nested-rpitits, r=spastorino Account for binders correctly when adding default RPITIT method assumption As of #108203, we install extra projection predicates into the param-env of a default trait method when it has return-position `impl Trait` (or is async). The implementation didn't account for the fact that it's walking into and out of binders, so we just need to shift all the debruijn indices accordingly when constructing the projection predicates. Fixes #108579 r? types
2023-03-06Implement inferred_outlives_of for impl side RPITITs assoc typeSantiago Pastorino-0/+3
2023-03-06Implement explicit_predicates_of for impl side RPITITs assoc typeSantiago Pastorino-0/+6
2023-03-06Implement generics_of for impl side RPITITs assoc typeSantiago Pastorino-6/+34
2023-03-06Implement param_env for RPITITs assoc typeSantiago Pastorino-2/+15
2023-03-06Properly implement explicit_item_bounds for RPITITs trait assoc tySantiago Pastorino-3/+0
2023-03-06Add tcx::lower_impl_trait_in_trait_to_assoc_ty to avoid accessing through ↵Santiago Pastorino-2/+2
sess.opts.unstable_opts
2023-03-05Auto merge of #108351 - petrochenkov:rmdit, r=cjgillotbors-2/+1
rustc_middle: Remove trait `DefIdTree` This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-02Feed queries on impl side for RPITITs when using ↵Santiago Pastorino-5/+65
lower_impl_trait_in_trait_to_assoc_ty
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-2/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-01Make associated_item_def_ids for traits use an unstable option to also ↵Santiago Pastorino-5/+89
return associated types for RPITITs