1- use rustc:: ty:: { self , Ty , TypeAndMut } ;
1+ use rustc:: ty:: { self , Ty , TypeAndMut , TypeFoldable } ;
22use rustc:: ty:: layout:: { self , TyLayout , Size } ;
33use rustc:: ty:: adjustment:: { PointerCast } ;
44use syntax:: ast:: FloatTy ;
@@ -36,6 +36,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
3636 // The src operand does not matter, just its type
3737 match src. layout . ty . sty {
3838 ty:: FnDef ( def_id, substs) => {
39+ // All reifications must be monomorphic, bail out otherwise.
40+ if src. layout . ty . needs_subst ( ) {
41+ throw_inval ! ( TooGeneric ) ;
42+ }
43+
3944 if self . tcx . has_attr ( def_id, sym:: rustc_args_required_const) {
4045 bug ! ( "reifying a fn ptr that requires const arguments" ) ;
4146 }
@@ -62,6 +67,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
6267 // The src operand does not matter, just its type
6368 match src. layout . ty . sty {
6469 ty:: Closure ( def_id, substs) => {
70+ // All reifications must be monomorphic, bail out otherwise.
71+ if src. layout . ty . needs_subst ( ) {
72+ throw_inval ! ( TooGeneric ) ;
73+ }
74+
6575 let instance = ty:: Instance :: resolve_closure (
6676 * self . tcx ,
6777 def_id,
0 commit comments