@@ -2033,7 +2033,7 @@ impl<'tcx> Operand<'tcx> {
20332033 Operand :: Constant ( box Constant {
20342034 span,
20352035 user_ty : None ,
2036- literal : ConstantSource :: Ty ( ty:: Const :: zero_sized ( tcx, ty) ) ,
2036+ literal : ConstantKind :: Ty ( ty:: Const :: zero_sized ( tcx, ty) ) ,
20372037 } )
20382038 }
20392039
@@ -2064,7 +2064,7 @@ impl<'tcx> Operand<'tcx> {
20642064 Operand :: Constant ( box Constant {
20652065 span,
20662066 user_ty : None ,
2067- literal : ConstantSource :: Val ( val. into ( ) , ty) ,
2067+ literal : ConstantKind :: Val ( val. into ( ) , ty) ,
20682068 } )
20692069 }
20702070
@@ -2406,11 +2406,11 @@ pub struct Constant<'tcx> {
24062406 /// Needed for NLL to impose user-given type constraints.
24072407 pub user_ty : Option < UserTypeAnnotationIndex > ,
24082408
2409- pub literal : ConstantSource < ' tcx > ,
2409+ pub literal : ConstantKind < ' tcx > ,
24102410}
24112411
24122412#[ derive( Clone , Copy , PartialEq , PartialOrd , TyEncodable , TyDecodable , Hash , HashStable , Debug ) ]
2413- pub enum ConstantSource < ' tcx > {
2413+ pub enum ConstantKind < ' tcx > {
24142414 /// This constant came from the type system
24152415 Ty ( & ' tcx ty:: Const < ' tcx > ) ,
24162416 /// This constant cannot go back into the type system, as it represents
@@ -2436,33 +2436,33 @@ impl Constant<'tcx> {
24362436 }
24372437}
24382438
2439- impl From < & ' tcx ty:: Const < ' tcx > > for ConstantSource < ' tcx > {
2439+ impl From < & ' tcx ty:: Const < ' tcx > > for ConstantKind < ' tcx > {
24402440 fn from ( ct : & ' tcx ty:: Const < ' tcx > ) -> Self {
24412441 Self :: Ty ( ct)
24422442 }
24432443}
24442444
2445- impl ConstantSource < ' tcx > {
2445+ impl ConstantKind < ' tcx > {
24462446 /// Returns `None` if the constant is not trivially safe for use in the type system.
24472447 pub fn const_for_ty ( & self ) -> Option < & ' tcx ty:: Const < ' tcx > > {
24482448 match self {
2449- ConstantSource :: Ty ( c) => Some ( c) ,
2450- ConstantSource :: Val ( ..) => None ,
2449+ ConstantKind :: Ty ( c) => Some ( c) ,
2450+ ConstantKind :: Val ( ..) => None ,
24512451 }
24522452 }
24532453
24542454 pub fn ty ( & self ) -> Ty < ' tcx > {
24552455 match self {
2456- ConstantSource :: Ty ( c) => c. ty ,
2457- ConstantSource :: Val ( _, ty) => ty,
2456+ ConstantKind :: Ty ( c) => c. ty ,
2457+ ConstantKind :: Val ( _, ty) => ty,
24582458 }
24592459 }
24602460
24612461 #[ inline]
24622462 pub fn try_to_value ( self ) -> Option < interpret:: ConstValue < ' tcx > > {
24632463 match self {
2464- ConstantSource :: Ty ( c) => c. val . try_to_value ( ) ,
2465- ConstantSource :: Val ( val, _) => Some ( val) ,
2464+ ConstantKind :: Ty ( c) => c. val . try_to_value ( ) ,
2465+ ConstantKind :: Val ( val, _) => Some ( val) ,
24662466 }
24672467 }
24682468
@@ -2709,8 +2709,8 @@ impl<'tcx> Display for Constant<'tcx> {
27092709 _ => write ! ( fmt, "const " ) ?,
27102710 }
27112711 match self . literal {
2712- ConstantSource :: Ty ( c) => pretty_print_const ( c, fmt, true ) ,
2713- ConstantSource :: Val ( val, ty) => pretty_print_const_value ( val, ty, fmt, true ) ,
2712+ ConstantKind :: Ty ( c) => pretty_print_const ( c, fmt, true ) ,
2713+ ConstantKind :: Val ( val, ty) => pretty_print_const_value ( val, ty, fmt, true ) ,
27142714 }
27152715 }
27162716}
0 commit comments