File tree 2 files changed +26
-1
lines changed
rustc_next_trait_solver/src/solve
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 34
34
) -> QueryResult < I > {
35
35
let cx = self . cx ( ) ;
36
36
let Goal { param_env, predicate : ( lhs, rhs, direction) } = goal;
37
- debug_assert ! ( lhs. to_alias_term( ) . is_some( ) || rhs. to_alias_term( ) . is_some( ) ) ;
37
+
38
+ // Check that the alias-relate goal is reasonable. Writeback for
39
+ // `coroutine_stalled_predicates` can replace alias terms with
40
+ // `{type error}` if the alias still contains infer vars, so we also
41
+ // accept alias-relate goals where one of the terms is an error.
42
+ debug_assert ! (
43
+ lhs. to_alias_term( ) . is_some( )
44
+ || rhs. to_alias_term( ) . is_some( )
45
+ || lhs. is_error( )
46
+ || rhs. is_error( )
47
+ ) ;
38
48
39
49
// Structurally normalize the lhs.
40
50
let lhs = if let Some ( alias) = lhs. to_alias_term ( ) {
Original file line number Diff line number Diff line change @@ -126,6 +126,10 @@ pub trait Ty<I: Interner<Ty = Self>>:
126
126
matches ! ( self . kind( ) , ty:: Infer ( ty:: TyVar ( _) ) )
127
127
}
128
128
129
+ fn is_ty_error ( self ) -> bool {
130
+ matches ! ( self . kind( ) , ty:: Error ( _) )
131
+ }
132
+
129
133
fn is_floating_point ( self ) -> bool {
130
134
matches ! ( self . kind( ) , ty:: Float ( _) | ty:: Infer ( ty:: FloatVar ( _) ) )
131
135
}
@@ -284,6 +288,10 @@ pub trait Const<I: Interner<Const = Self>>:
284
288
fn is_ct_var ( self ) -> bool {
285
289
matches ! ( self . kind( ) , ty:: ConstKind :: Infer ( ty:: InferConst :: Var ( _) ) )
286
290
}
291
+
292
+ fn is_ct_error ( self ) -> bool {
293
+ matches ! ( self . kind( ) , ty:: ConstKind :: Error ( _) )
294
+ }
287
295
}
288
296
289
297
pub trait ValueConst < I : Interner < ValueConst = Self > > : Copy + Debug + Hash + Eq {
@@ -370,6 +378,13 @@ pub trait Term<I: Interner<Term = Self>>:
370
378
}
371
379
}
372
380
381
+ fn is_error ( self ) -> bool {
382
+ match self . kind ( ) {
383
+ ty:: TermKind :: Ty ( ty) => ty. is_ty_error ( ) ,
384
+ ty:: TermKind :: Const ( ct) => ct. is_ct_error ( ) ,
385
+ }
386
+ }
387
+
373
388
fn to_alias_term ( self ) -> Option < ty:: AliasTerm < I > > {
374
389
match self . kind ( ) {
375
390
ty:: TermKind :: Ty ( ty) => match ty. kind ( ) {
You can’t perform that action at this time.
0 commit comments