File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
rustc_next_trait_solver/src/solve Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 3434 ) -> QueryResult < I > {
3535 let cx = self . cx ( ) ;
3636 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+ ) ;
3848
3949 // Structurally normalize the lhs.
4050 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>>:
126126 matches ! ( self . kind( ) , ty:: Infer ( ty:: TyVar ( _) ) )
127127 }
128128
129+ fn is_ty_error ( self ) -> bool {
130+ matches ! ( self . kind( ) , ty:: Error ( _) )
131+ }
132+
129133 fn is_floating_point ( self ) -> bool {
130134 matches ! ( self . kind( ) , ty:: Float ( _) | ty:: Infer ( ty:: FloatVar ( _) ) )
131135 }
@@ -284,6 +288,10 @@ pub trait Const<I: Interner<Const = Self>>:
284288 fn is_ct_var ( self ) -> bool {
285289 matches ! ( self . kind( ) , ty:: ConstKind :: Infer ( ty:: InferConst :: Var ( _) ) )
286290 }
291+
292+ fn is_ct_error ( self ) -> bool {
293+ matches ! ( self . kind( ) , ty:: ConstKind :: Error ( _) )
294+ }
287295}
288296
289297pub trait ValueConst < I : Interner < ValueConst = Self > > : Copy + Debug + Hash + Eq {
@@ -370,6 +378,13 @@ pub trait Term<I: Interner<Term = Self>>:
370378 }
371379 }
372380
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+
373388 fn to_alias_term ( self ) -> Option < ty:: AliasTerm < I > > {
374389 match self . kind ( ) {
375390 ty:: TermKind :: Ty ( ty) => match ty. kind ( ) {
You can’t perform that action at this time.
0 commit comments