@@ -14,13 +14,13 @@ use hir_def::{
14
14
} ;
15
15
use hir_expand:: name:: Name ;
16
16
use intern:: sym;
17
- use stdx:: panic_context;
17
+ use stdx:: { never , panic_context} ;
18
18
use triomphe:: Arc ;
19
19
20
20
use crate :: {
21
21
db:: HirDatabase , infer:: unify:: InferenceTable , utils:: UnevaluatedConstEvaluatorFolder , AliasEq ,
22
22
AliasTy , Canonical , DomainGoal , Goal , Guidance , InEnvironment , Interner , ProjectionTy ,
23
- ProjectionTyExt , Solution , TraitRefExt , Ty , TyKind , WhereClause ,
23
+ ProjectionTyExt , Solution , TraitRefExt , Ty , TyKind , TypeFlags , WhereClause ,
24
24
} ;
25
25
26
26
/// This controls how much 'time' we give the Chalk solver before giving up.
@@ -90,6 +90,16 @@ pub(crate) fn normalize_projection_query(
90
90
projection : ProjectionTy ,
91
91
env : Arc < TraitEnvironment > ,
92
92
) -> Ty {
93
+ if projection. substitution . iter ( Interner ) . any ( |arg| {
94
+ arg. ty ( Interner )
95
+ . is_some_and ( |ty| ty. data ( Interner ) . flags . intersects ( TypeFlags :: HAS_TY_INFER ) )
96
+ } ) {
97
+ never ! (
98
+ "Invoking `normalize_projection_query` with a projection type containing inference var"
99
+ ) ;
100
+ return TyKind :: Error . intern ( Interner ) ;
101
+ }
102
+
93
103
let mut table = InferenceTable :: new ( db, env) ;
94
104
let ty = table. normalize_projection_ty ( projection) ;
95
105
table. resolve_completely ( ty)
0 commit comments