Skip to content

Commit 0bed12e

Browse files
committed
hir_analysis: skip self type of host effect preds
Like trait predicates, the self type ought to be skipped here.
1 parent 7bf6fc1 commit 0bed12e

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

compiler/rustc_hir_analysis/src/variance/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ fn variance_of_opaque(
198198
ty::ClauseKind::Trait(ty::TraitPredicate {
199199
trait_ref: ty::TraitRef { def_id: _, args, .. },
200200
polarity: _,
201+
})
202+
| ty::ClauseKind::HostEffect(ty::HostEffectPredicate {
203+
trait_ref: ty::TraitRef { def_id: _, args, .. },
204+
constness: _,
201205
}) => {
202206
for arg in &args[1..] {
203207
arg.visit_with(&mut collector);

tests/ui/traits/const-traits/variance.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ trait Foo {}
88
impl const Foo for () {}
99

1010
fn foo<'a: 'a>() -> impl const Foo {}
11-
//~^ ERROR ['a: o]
11+
//~^ ERROR ['a: *]
1212

1313
fn main() {}
14-

tests/ui/traits/const-traits/variance.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: ['a: o]
1+
error: ['a: *]
22
--> $DIR/variance.rs:10:21
33
|
44
LL | fn foo<'a: 'a>() -> impl const Foo {}

0 commit comments

Comments
 (0)