Skip to content

Commit cba475b

Browse files
authored
Unrolled build for rust-lang#137613
Rollup merge of rust-lang#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``
2 parents a46c755 + 0bed12e commit cba475b

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
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);
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(rustc_attrs, const_trait_impl)]
2+
#![allow(internal_features)]
3+
#![rustc_variance_of_opaques]
4+
5+
#[const_trait]
6+
trait Foo {}
7+
8+
impl const Foo for () {}
9+
10+
fn foo<'a: 'a>() -> impl const Foo {}
11+
//~^ ERROR ['a: *]
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: ['a: *]
2+
--> $DIR/variance.rs:10:21
3+
|
4+
LL | fn foo<'a: 'a>() -> impl const Foo {}
5+
| ^^^^^^^^^^^^^^
6+
7+
error: aborting due to 1 previous error
8+

0 commit comments

Comments
 (0)