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 1
1
use super :: { ErrorHandled , EvalToConstValueResult , GlobalId } ;
2
2
3
3
use crate :: mir;
4
+ use crate :: ty:: fold:: TypeFoldable ;
4
5
use crate :: ty:: subst:: InternalSubsts ;
5
6
use crate :: ty:: { self , TyCtxt } ;
6
7
use rustc_hir:: def_id:: DefId ;
@@ -38,6 +39,13 @@ impl<'tcx> TyCtxt<'tcx> {
38
39
ct : ty:: Unevaluated < ' tcx > ,
39
40
span : Option < Span > ,
40
41
) -> 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
+
41
49
match ty:: Instance :: resolve_opt_const_arg ( self , param_env, ct. def , ct. substs ) {
42
50
Ok ( Some ( instance) ) => {
43
51
let cid = GlobalId { instance, promoted : ct. promoted } ;
You can’t perform that action at this time.
0 commit comments