File tree Expand file tree Collapse file tree 3 files changed +8
-11
lines changed
rustc_const_eval/src/const_eval
rustc_transmute/src/layout Expand file tree Collapse file tree 3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -67,18 +67,13 @@ pub(crate) fn try_destructure_mir_constant_for_user_output<'tcx>(
6767#[ instrument( skip( tcx) , level = "debug" ) ]
6868pub fn tag_for_variant_provider < ' tcx > (
6969 tcx : TyCtxt < ' tcx > ,
70- ( ty , variant_index ) : ( Ty < ' tcx > , VariantIdx ) ,
70+ key : ty :: PseudoCanonicalInput < ' tcx , ( Ty < ' tcx > , VariantIdx ) > ,
7171) -> Option < ty:: ScalarInt > {
72+ let ( ty, variant_index) = key. value ;
7273 assert ! ( ty. is_enum( ) ) ;
7374
74- // FIXME: This uses an empty `TypingEnv` even though
75- // it may be used by a generic CTFE.
76- let ecx = InterpCx :: new (
77- tcx,
78- ty. default_span ( tcx) ,
79- ty:: TypingEnv :: fully_monomorphized ( ) ,
80- crate :: const_eval:: DummyMachine ,
81- ) ;
75+ let ecx =
76+ InterpCx :: new ( tcx, ty. default_span ( tcx) , key. typing_env , crate :: const_eval:: DummyMachine ) ;
8277
8378 let layout = ecx. layout_of ( ty) . unwrap ( ) ;
8479 ecx. tag_for_variant ( layout, variant_index) . unwrap ( ) . map ( |( tag, _tag_field) | tag)
Original file line number Diff line number Diff line change @@ -1311,7 +1311,7 @@ rustc_queries! {
13111311 ///
13121312 /// This query will panic for uninhabited variants and if the passed type is not an enum.
13131313 query tag_for_variant(
1314- key: ( Ty <' tcx>, abi:: VariantIdx )
1314+ key: PseudoCanonicalInput < ' tcx , ( Ty <' tcx>, abi:: VariantIdx ) > ,
13151315 ) -> Option <ty:: ScalarInt > {
13161316 desc { "computing variant tag for enum" }
13171317 }
Original file line number Diff line number Diff line change @@ -432,7 +432,9 @@ pub(crate) mod rustc {
432432 if variant_layout. is_uninhabited ( ) {
433433 return Ok ( Self :: uninhabited ( ) ) ;
434434 }
435- let tag = cx. tcx ( ) . tag_for_variant ( ( cx. tcx ( ) . erase_regions ( ty) , index) ) ;
435+ let tag = cx. tcx ( ) . tag_for_variant (
436+ cx. typing_env . as_query_input ( ( cx. tcx ( ) . erase_regions ( ty) , index) ) ,
437+ ) ;
436438 let variant_def = Def :: Variant ( def. variant ( index) ) ;
437439 Self :: from_variant (
438440 variant_def,
You can’t perform that action at this time.
0 commit comments