rust/compiler/rustc_hir_analysis/src
Guillaume Gomez 0e3764889d
Rollup merge of #121863 - lukas-code:silence-mismatched-super-projections, r=lcnr
silence mismatched types errors for implied projections

Currently, if a trait bound is not satisfied, then we suppress any errors for the trait's supertraits not being satisfied, but still report errors for super projections not being satisfied.

For example:
```rust
trait Super {
    type Assoc;
}
trait Sub: Super<Assoc = ()> {}
```
Before this PR, if `T: Sub` is not satisfied, then errors for `T: Super` are suppressed, but errors for `<T as Super>::Assoc == ()` are still shown. This PR makes it so that errors about super projections not being satisfied are also suppressed.

The errors are only suppressed if the span of the trait obligation matches the span of the super predicate obligation to avoid silencing error that are not related. This PR removes some differences between the spans of supertraits and super projections to make the suppression work correctly.

This PR fixes the majority of the diagnostics fallout when making `Thin` a supertrait of `Sized` (in a future PR).
cc https://github.com/rust-lang/rust/pull/120354#issuecomment-1930585382
cc `@lcnr`
2024-03-07 15:07:05 +01:00
..
astconv Rename StructuredDiagnostic as StructuredDiag. 2024-03-05 12:15:12 +11:00
check Rollup merge of #121863 - lukas-code:silence-mismatched-super-projections, r=lcnr 2024-03-07 15:07:05 +01:00
coherence Auto merge of #120393 - Urgau:rfc3373-non-local-defs, r=WaffleLapkin 2024-02-25 19:11:06 +00:00
collect Rollup merge of #122027 - compiler-errors:rpitit-cycle, r=spastorino 2024-03-06 22:41:55 +01:00
impl_wf_check Use expand_weak_alias_tys when collecting constrained generics params in impls 2024-02-20 17:31:59 +01:00
outlives Auto merge of #120931 - chenyukang:yukang-cleanup-hashmap, r=michaelwoerister 2024-02-15 12:36:37 +00:00
structured_errors Rename StructuredDiagnostic as StructuredDiag. 2024-03-05 12:15:12 +11:00
variance Convert TypeVisitor and DefIdVisitor to use VisitorResult 2024-03-05 13:28:15 -05:00
autoderef.rs fix ICE for deref coercions with type errors 2024-02-12 14:37:35 +01:00
bounds.rs ~const trait or projection bounds do not imply non-const bounds 2024-01-08 15:01:14 +00:00
check_unused.rs Rename TyCtxt::struct_span_lint_hir as TyCtxt::node_span_lint. 2024-01-23 08:09:01 +11:00
collect.rs hir_analysis: enums return None in find_field 2024-03-04 11:38:16 +00:00
constrained_generic_params.rs Convert TypeVisitor and DefIdVisitor to use VisitorResult 2024-03-05 13:28:15 -05:00
errors.rs Remove unused diagnostic struct 2024-02-29 14:14:21 +08:00
hir_wf_check.rs Remove Session methods that duplicate DiagCtxt methods. 2023-12-24 08:05:28 +11:00
impl_wf_check.rs Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
lib.rs Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
structured_errors.rs Rename StructuredDiagnostic as StructuredDiag. 2024-03-05 12:15:12 +11:00