diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2024-12-11 03:30:41 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-11 03:30:41 -0500 |
| commit | 5cf16d8b1f2d7ce3a22995f77767c16fcccbab07 (patch) | |
| tree | e217b87e44f8e431e8eeae5c05bd5e6b7dc9586e /compiler/rustc_hir_analysis/src | |
| parent | 43b4af5b77e8a258ac9fd0d775efebd3f3397528 (diff) | |
| parent | 5d1b6bfc6ad95298fe3637857976945bd6ae9d9d (diff) | |
| download | rust-5cf16d8b1f2d7ce3a22995f77767c16fcccbab07.tar.gz rust-5cf16d8b1f2d7ce3a22995f77767c16fcccbab07.zip | |
Rollup merge of #134105 - compiler-errors:validate-self-preds, r=wesleywiser
Validate self in host predicates correctly `assert_only_contains_predicates_from` was added to make sure that we are computing predicates for the correct self type for a given `PredicateFilter`. That was not implemented correctly for `PredicateFilter::SelfOnly` when there are const predicates. Fixes #133526
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect/predicates_of.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index ca2597e79fd..1a6c0a93436 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -711,12 +711,19 @@ pub(super) fn assert_only_contains_predicates_from<'tcx>( `{filter:?}` implied bounds: {clause:?}" ); } + ty::ClauseKind::HostEffect(host_effect_predicate) => { + assert_eq!( + host_effect_predicate.self_ty(), + ty, + "expected `Self` predicate when computing \ + `{filter:?}` implied bounds: {clause:?}" + ); + } ty::ClauseKind::RegionOutlives(_) | ty::ClauseKind::ConstArgHasType(_, _) | ty::ClauseKind::WellFormed(_) - | ty::ClauseKind::ConstEvaluatable(_) - | ty::ClauseKind::HostEffect(..) => { + | ty::ClauseKind::ConstEvaluatable(_) => { bug!( "unexpected non-`Self` predicate when computing \ `{filter:?}` implied bounds: {clause:?}" |
