File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
compiler/rustc_middle/src/mir/interpret Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11use super :: { ErrorHandled , EvalToConstValueResult , GlobalId } ;
22
33use crate :: mir;
4+ use crate :: ty:: fold:: TypeFoldable ;
45use crate :: ty:: subst:: InternalSubsts ;
56use crate :: ty:: { self , TyCtxt } ;
67use rustc_hir:: def_id:: DefId ;
@@ -38,6 +39,13 @@ impl<'tcx> TyCtxt<'tcx> {
3839 ct : ty:: Unevaluated < ' tcx > ,
3940 span : Option < Span > ,
4041 ) -> EvalToConstValueResult < ' tcx > {
42+ // Cannot resolve `Unevaluated` constants that contain inference
43+ // variables. We reject those here since `resolve_opt_const_arg`
44+ // would fail otherwise
45+ if ct. substs . has_infer_types_or_consts ( ) {
46+ return Err ( ErrorHandled :: TooGeneric ) ;
47+ }
48+
4149 match ty:: Instance :: resolve_opt_const_arg ( self , param_env, ct. def , ct. substs ) {
4250 Ok ( Some ( instance) ) => {
4351 let cid = GlobalId { instance, promoted : ct. promoted } ;
You can’t perform that action at this time.
0 commit comments