@@ -6,7 +6,7 @@ use crate::{clip, is_direct_expn_of, sext, unsext};
66use rustc_ast:: ast:: { self , LitFloatType , LitKind } ;
77use rustc_data_structures:: sync:: Lrc ;
88use rustc_hir:: def:: { DefKind , Res } ;
9- use rustc_hir:: { BinOp , BinOpKind , Block , Expr , ExprKind , HirId , Item , ItemKind , Node , QPath , UnOp } ;
9+ use rustc_hir:: { BinOp , BinOpKind , Block , ConstBlock , Expr , ExprKind , HirId , Item , ItemKind , Node , QPath , UnOp } ;
1010use rustc_lexer:: tokenize;
1111use rustc_lint:: LateContext ;
1212use rustc_middle:: mir:: interpret:: { alloc_range, Scalar } ;
@@ -412,7 +412,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
412412 /// Simple constant folding: Insert an expression, get a constant or none.
413413 pub fn expr ( & mut self , e : & Expr < ' _ > ) -> Option < Constant < ' tcx > > {
414414 match e. kind {
415- ExprKind :: ConstBlock ( e ) | ExprKind :: DropTemps ( e) => self . expr ( e) ,
415+ ExprKind :: ConstBlock ( ConstBlock { body , .. } ) => self . expr ( self . lcx . tcx . hir ( ) . body ( body ) . value ) , ExprKind :: DropTemps ( e) => self . expr ( e) ,
416416 ExprKind :: Path ( ref qpath) => {
417417 self . fetch_path_and_apply ( qpath, e. hir_id , self . typeck_results . expr_ty ( e) , |this, result| {
418418 let result = mir_to_const ( this. lcx , result) ?;
@@ -490,7 +490,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
490490 /// leaves the local crate.
491491 pub fn expr_is_empty ( & mut self , e : & Expr < ' _ > ) -> Option < bool > {
492492 match e. kind {
493- ExprKind :: ConstBlock ( e ) | ExprKind :: DropTemps ( e) => self . expr_is_empty ( e) ,
493+ ExprKind :: ConstBlock ( ConstBlock { body , .. } ) => self . expr_is_empty ( self . lcx . tcx . hir ( ) . body ( body ) . value ) , ExprKind :: DropTemps ( e) => self . expr_is_empty ( e) ,
494494 ExprKind :: Path ( ref qpath) => {
495495 if !self
496496 . typeck_results
0 commit comments