@@ -14,13 +14,13 @@ use hir_def::{
1414} ;
1515use hir_expand:: name:: Name ;
1616use intern:: sym;
17- use stdx:: panic_context;
17+ use stdx:: { never , panic_context} ;
1818use triomphe:: Arc ;
1919
2020use crate :: {
2121 db:: HirDatabase , infer:: unify:: InferenceTable , utils:: UnevaluatedConstEvaluatorFolder , AliasEq ,
2222 AliasTy , Canonical , DomainGoal , Goal , Guidance , InEnvironment , Interner , ProjectionTy ,
23- ProjectionTyExt , Solution , TraitRefExt , Ty , TyKind , WhereClause ,
23+ ProjectionTyExt , Solution , TraitRefExt , Ty , TyKind , TypeFlags , WhereClause ,
2424} ;
2525
2626/// This controls how much 'time' we give the Chalk solver before giving up.
@@ -90,6 +90,16 @@ pub(crate) fn normalize_projection_query(
9090 projection : ProjectionTy ,
9191 env : Arc < TraitEnvironment > ,
9292) -> 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+
93103 let mut table = InferenceTable :: new ( db, env) ;
94104 let ty = table. normalize_projection_ty ( projection) ;
95105 table. resolve_completely ( ty)
0 commit comments