about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2023-02-13Make folding traits generic over the InternerAlan Egerton-4/+4
2023-02-13Make visiting traits generic over the InternerAlan Egerton-8/+8
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-12/+12
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-6/+5
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-11Auto merge of #107507 - BoxyUwU:deferred_projection_equality, r=lcnrbors-0/+3
Implement `deferred_projection_equality` for erica solver Somewhat of a revival of #96912. When relating projections now emit an `AliasEq` obligation instead of attempting to determine equality of projections that may not be as normalized as possible (i.e. because of lazy norm, or just containing inference variables that prevent us from resolving an impl). Only do this when the new solver is enabled
2023-02-10add `AliasEq` to `PredicateKind`Boxy-0/+3
2023-02-09Use `ErrorGuaranteed` more in `ReError`Esteban Küber-5/+5
2023-02-09Change to `ReError(ErrorGuaranteed)`Esteban Küber-14/+6
2023-02-09review commentsEsteban Küber-1/+1
2023-02-09Introduce `ReError`Esteban Küber-11/+9
CC #69314
2023-02-09Auto merge of #106938 - GuillaumeGomez:normalize-projection-field-ty, r=oli-obkbors-1/+1
Add missing normalization for union fields types Overshadows https://github.com/rust-lang/rust/pull/106808. From the experiment https://github.com/rust-lang/rust/pull/103985. In short, it allows to use projections as a type for union's fields. cc `@compiler-errors` r? `@oli-obk`
2023-02-07Replacing bound vars is actually instantiating a binderMichael Goulet-2/+2
2023-02-07Rollup merge of #107555 - edward-shen:edward-shen/dup-trait-suggestion, ↵Matthias Krüger-0/+1
r=compiler-errors Modify existing bounds if they exist Fixes #107335. This implementation is kinda gross but I don't really see a better way to do it. This primarily does two things: Modifies `suggest_constraining_type_param` to accept a new parameter that indicates a span to be replaced instead of added, if presented, and limit the additive suggestions to either suggest a new bound on an existing bound (see newly added unit test) or add the generics argument if a generics argument wasn't found. The former change is required to retain the capability to add an entirely new bounds if it was entirely omitted. r? ``@compiler-errors``
2023-02-06Modify existing bounds if they existEdward Shen-0/+1
2023-02-06remove unused importsklensy-3/+0
2023-02-03Make const/fn return params more suggestableMichael Goulet-59/+32
2023-02-03Autotrait bounds on dyn-safe trait methodsDavid Tolnay-0/+22
2023-02-03Disallow impl autotrait for trait objectDavid Tolnay-40/+161
2023-01-31Rollup merge of #107486 - compiler-errors:bound-ty-keep-name, r=oli-obkGuillaume Gomez-1/+1
Track bound types like bound regions When we instantiate bound types into placeholder types, we throw away the names for some reason. These names are particularly useful for error reporting once we have `for<T>` binders. r? types
2023-01-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-52/+58
Improve enum checks Some light refactoring.
2023-01-31Auto merge of #106399 - estebank:type-err-span-label, r=nagisabors-0/+1
Modify primary span label for E0308 Looking at the reactions to https://hachyderm.io/`@ekuber/109622160673605438,` a lot of people seem to have trouble understanding the current output, where the primary span label on type errors talks about the specific types that diverged, but these can be deeply nested type parameters. Because of that we could see "expected i32, found u32" in the label while the note said "expected Vec<i32>, found Vec<u32>". This understandably confuses people. I believe that once people learn to read these errors it starts to make more sense, but this PR changes the output to be more in line with what people might expect, without sacrificing terseness. Fix #68220.
2023-01-30Track bound types like bound regionsMichael Goulet-1/+1
2023-01-30review commentsEsteban Küber-4/+2
2023-01-30Modify primary span label for E0308Esteban Küber-1/+4
The previous output was unintuitive to users.
2023-01-30Rollup merge of #107125 - ↵Matthias Krüger-22/+18
WaffleLapkin:expect_an_item_in_your_hir_by_the_next_morning, r=Nilstrieb Add and use expect methods to hir. [The future has come](https://github.com/rust-lang/rust/pull/106090/files#r1070062462). r? `@Nilstrieb` tbh I'm not even sure if it's worth it
2023-01-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-52/+58
2023-01-30Use `expect_{use,fn}` in a couple of placesMaybe Waffle-2/+2
2023-01-29Auto merge of #106253 - nbdd0121:upcast, r=compiler-errorsbors-2/+2
Skip possible where_clause_object_safety lints when checking `multiple_supertrait_upcastable` Fix #106247 To achieve this, I lifted the `WhereClauseReferencesSelf` out from `object_safety_violations` and move it into `is_object_safe` (which is changed to a new query). cc `@dtolnay` r? `@compiler-errors`
2023-01-28Auto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkinbors-38/+50
Remove HirId -> LocalDefId map from HIR. Having this map in HIR prevents the creating of new definitions after HIR has been built. Thankfully, we do not need it. Based on https://github.com/rust-lang/rust/pull/103902
2023-01-28Rename `is_object_safe` to `check_is_object_safe` to hint side effectsGary Guo-2/+2
2023-01-28Replace `object_safety_violations().is_empty()` calls with `is_object_safe`Gary Guo-1/+1
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-37/+49
2023-01-28Take a LocalDefId in hir::Visitor::visit_fn.Camille GILLOT-1/+1
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-28Rollup merge of #107100 - compiler-errors:issue-107087, r=lcnrMatthias Krüger-46/+66
Use proper `InferCtxt` when probing for associated types in astconv Fixes #107087
2023-01-27Compute generator saved locals on MIR.Camille GILLOT-3/+36
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-6/+7
2023-01-27update comment on trait objectsAli MJ Al-Nasrawy-1/+1
2023-01-26fix up subst_identity vs skip_binder; add some FIXMEs as identified in reviewKyle Matsuda-5/+5
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-24/+30
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-20/+26
2023-01-27internally change regions to be covariantAli MJ Al-Nasrawy-5/+3
2023-01-23Use proper InferCtxt when probing for associated types in astconvMichael Goulet-46/+66
2023-01-23fix: use LocalDefId instead of HirId in trait resVincenzo Palazzo-112/+117
use LocalDefId instead of HirId in trait resolution to simplify the obligation clause resolution Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-21Rollup merge of #106578 - compiler-errors:recursive-opaque-closure, r=TaKO8KiMichael Goulet-6/+53
Label closure captures/generator locals that make opaque types recursive cc https://github.com/rust-lang/rust/issues/46415#issuecomment-1374665828
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-21Label closure captures/generator locals that make opaque types recursiveMichael Goulet-6/+53
2023-01-20Auto merge of #105102 - compiler-errors:copy-impl-considering-regions, r=lcnrbors-44/+66
Check ADT fields for copy implementations considering regions Fixes #88901 r? `@ghost`
2023-01-20Add and use expect methods to hir.Maybe Waffle-20/+16