@@ -1165,7 +1165,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
11651165 AggregateKind :: Adt ( adt_did, variant, args, _user_ty, _) => {
11661166 ty:: tls:: with ( |tcx| {
11671167 let variant_def = & tcx. adt_def ( adt_did) . variant ( variant) ;
1168- let args = tcx. lift ( args) . expect ( "could not lift for printing" ) ;
1168+ let args = tcx. lift ( args) ;
11691169 let name = FmtPrinter :: print_string ( tcx, Namespace :: ValueNS , |p| {
11701170 p. print_def_path ( variant_def. def_id , args)
11711171 } ) ?;
@@ -1187,7 +1187,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
11871187 AggregateKind :: Closure ( def_id, args)
11881188 | AggregateKind :: CoroutineClosure ( def_id, args) => ty:: tls:: with ( |tcx| {
11891189 let name = if tcx. sess . opts . unstable_opts . span_free_formats {
1190- let args = tcx. lift ( args) . unwrap ( ) ;
1190+ let args = tcx. lift ( args) ;
11911191 format ! ( "{{closure@{}}}" , tcx. def_path_str_with_args( def_id, args) , )
11921192 } else {
11931193 let span = tcx. def_span ( def_id) ;
@@ -1911,8 +1911,6 @@ fn pretty_print_const_value_tcx<'tcx>(
19111911 // E.g. `transmute([0usize; 2]): (u8, *mut T)` needs to know `T: Sized`
19121912 // to be able to destructure the tuple into `(0u8, *mut T)`
19131913 ( _, ty:: Array ( ..) | ty:: Tuple ( ..) | ty:: Adt ( ..) ) if !ty. has_non_region_param ( ) => {
1914- let ct = tcx. lift ( ct) . unwrap ( ) ;
1915- let ty = tcx. lift ( ty) . unwrap ( ) ;
19161914 if let Some ( contents) = tcx. try_destructure_mir_constant_for_user_output ( ct, ty) {
19171915 let fields: Vec < ( ConstValue , Ty < ' _ > ) > = contents. fields . to_vec ( ) ;
19181916 match * ty. kind ( ) {
@@ -1937,7 +1935,6 @@ fn pretty_print_const_value_tcx<'tcx>(
19371935 . variant
19381936 . expect ( "destructed mir constant of adt without variant idx" ) ;
19391937 let variant_def = & def. variant ( variant_idx) ;
1940- let args = tcx. lift ( args) . unwrap ( ) ;
19411938 let mut p = FmtPrinter :: new ( tcx, Namespace :: ValueNS ) ;
19421939 p. print_alloc_ids = true ;
19431940 p. pretty_print_value_path ( variant_def. def_id , args) ?;
@@ -1974,7 +1971,6 @@ fn pretty_print_const_value_tcx<'tcx>(
19741971 ( ConstValue :: Scalar ( scalar) , _) => {
19751972 let mut p = FmtPrinter :: new ( tcx, Namespace :: ValueNS ) ;
19761973 p. print_alloc_ids = true ;
1977- let ty = tcx. lift ( ty) . unwrap ( ) ;
19781974 p. pretty_print_const_scalar ( scalar, ty) ?;
19791975 fmt. write_str ( & p. into_buffer ( ) ) ?;
19801976 return Ok ( ( ) ) ;
@@ -2000,8 +1996,7 @@ pub(crate) fn pretty_print_const_value<'tcx>(
20001996 fmt : & mut Formatter < ' _ > ,
20011997) -> fmt:: Result {
20021998 ty:: tls:: with ( |tcx| {
2003- let ct = tcx. lift ( ct) . unwrap ( ) ;
2004- let ty = tcx. lift ( ty) . unwrap ( ) ;
1999+ let ty = tcx. lift ( ty) ;
20052000 pretty_print_const_value_tcx ( tcx, ct, ty, fmt)
20062001 } )
20072002}
0 commit comments