Rollup merge of #137613 - davidtwco:const-traits-variances, r=compiler-errors

hir_analysis: skip self type of host effect preds in variances_of

Discovered as part of an implementation of rust-lang/rfcs#3729 - w/out this then when introducing const trait bounds: many more interesting tests change with different output, missing errors, new errors, etc related to this but they all depend on feature flags and are much more complex than this test.

r? ``@oli-obk``
This commit is contained in:
León Orell Valerian Liehr 2025-02-26 04:15:08 +01:00 committed by GitHub
commit cf8498d36a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View file

@ -198,6 +198,10 @@ fn variance_of_opaque(
ty::ClauseKind::Trait(ty::TraitPredicate {
trait_ref: ty::TraitRef { def_id: _, args, .. },
polarity: _,
})
| ty::ClauseKind::HostEffect(ty::HostEffectPredicate {
trait_ref: ty::TraitRef { def_id: _, args, .. },
constness: _,
}) => {
for arg in &args[1..] {
arg.visit_with(&mut collector);