summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/variance
AgeCommit message (Collapse)AuthorLines
2023-02-22Remove type-traversal trait aliasesAlan Egerton-4/+2
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-3/+3
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-3/+3
2023-02-13Make visiting traits generic over the InternerAlan Egerton-1/+1
2023-02-13Workaround issue #107747Alan Egerton-1/+3
Only required until fix #107803 is merged into stage0 compiler, expected when beta 1.69.0 is released on 2023-03-09, then this commit can be reverted.
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-1/+1
2023-02-09Change to `ReError(ErrorGuaranteed)`Esteban Küber-1/+1
2023-02-09Introduce `ReError`Esteban Küber-0/+2
CC #69314
2023-01-28Rollup merge of #107339 - aliemjay:covariant, r=lcnrMatthias Krüger-5/+3
internally change regions to be covariant Surprisingly, we consider the reference type `&'a T` to be contravaraint in its lifetime parameter. This is confusing and conflicts with the documentation we have in the reference, rustnomicon, and rustc-dev-guide. This also arguably not the correct use of terminology since we can use `&'static u8` in a place where `&' a u8` is expected, this implies that `&'static u8 <: &' a u8` and consequently `'static <: ' a`, hence covariance. Because of this, when relating two types, we used to switch the argument positions in a confusing way: `Subtype(&'a u8 <: &'b u8) => Subtype('b <: 'a) => Outlives('a: 'b) => RegionSubRegion('b <= 'a)` The reason for the current behavior is probably that we wanted `Subtype('b <: 'a)` and `RegionSubRegion('b <= 'a)` to be equivalent, but I don' t think this is a good reason since these relations are sufficiently different in that the first is a relation in the subtyping lattice and is intrinsic to the type-systems, while the the second relation is an implementation detail of regionck. This PR changes this behavior to use covariance, so.. `Subtype(&'a u8 <: &'b u8) => Subtype('a <: 'b) => Outlives('a: 'b) => RegionSubRegion('b <= 'a) ` Resolves #103676 r? `@lcnr`
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-6/+6
2023-01-27update comment on trait objectsAli MJ Al-Nasrawy-1/+1
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-1/+1
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-1/+5
2023-01-27internally change regions to be covariantAli MJ Al-Nasrawy-5/+3
2023-01-21Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obkbors-9/+6
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-20Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstriebbors-2/+2
Remove some `ref` patterns from the compiler Previous PR: https://github.com/rust-lang/rust/pull/105368 r? `@Nilstrieb`
2023-01-19Rollup merge of #106931 - Ezrashaw:docs-e0208, r=compiler-errorsGuillaume Gomez-3/+2
document + UI test `E0208` and make its output more user-friendly Cleans up `E0208`'s output a lot. It could actually be useful for someone learning about variance now. I also added a UI test for it in `tests/ui/error-codes/` and wrote some docs for it. r? `@GuillaumeGomez` another error code, can't be bothered to find the issue :P. Obviously there's some compiler stuff, so you'll have to hand it off. Part of https://github.com/rust-lang/rust/issues/61137.
2023-01-19Use UnordMap instead of FxHashMap in define_id_collections!().Michael Woerister-9/+6
2023-01-18remove error code from `#[rustc_variance]` and document its remainsEzra Shaw-3/+2
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-1/+1
Switching them to `Break(())` and `Continue(())` instead. libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2023-01-17`rustc_hir_analysis`: remove `ref` patternsMaybe Waffle-2/+2
2022-12-14Prevent the creation of `TraitRef` without dedicated methodsOli Scherer-1/+1
2022-12-14Ensure no one constructs `AliasTy`s themselvesOli Scherer-2/+2
2022-12-13Address a few more nitsMichael Goulet-5/+6
2022-12-13Combine identical alias armsMichael Goulet-5/+1
2022-12-13Combine projection and opaque into aliasMichael Goulet-4/+4
2022-12-13squash OpaqueTy and ProjectionTy into AliasTyMichael Goulet-5/+5
2022-12-13ProjectionTy.item_def_id -> ProjectionTy.def_idMichael Goulet-5/+6
2022-12-13Use ty::OpaqueTy everywhereMichael Goulet-1/+1
2022-12-04Recurse into nested impl-trait when computing variance.Camille GILLOT-4/+38
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-7/+7
2022-11-25Introduce PredicateKind::ClauseSantiago Pastorino-5/+8
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-4/+4
2022-11-14Typo.Camille GILLOT-1/+1
2022-11-12Compute variance for opaques too.Camille GILLOT-2/+92
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-3/+4
spastorino noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.
2022-09-27rustc_typeck to rustc_hir_analysislcnr-0/+824