File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
compiler/rustc_middle/src/ty/consts Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -42,21 +42,29 @@ pub enum ValTreeKind<'tcx> {
4242
4343impl < ' tcx > ValTreeKind < ' tcx > {
4444 #[ inline]
45+ #[ track_caller]
4546 pub fn unwrap_leaf ( & self ) -> ScalarInt {
4647 match self {
4748 Self :: Leaf ( s) => * s,
48- _ => bug ! ( "expected leaf, got {:?}" , self ) ,
49+ _ => self . unwrap_failed ( ) ,
4950 }
5051 }
5152
5253 #[ inline]
54+ #[ track_caller]
5355 pub fn unwrap_branch ( & self ) -> & [ ValTree < ' tcx > ] {
5456 match self {
5557 Self :: Branch ( branch) => & * * branch,
56- _ => bug ! ( "expected branch, got {:?}" , self ) ,
58+ _ => self . unwrap_failed ( ) ,
5759 }
5860 }
5961
62+ #[ inline( never) ]
63+ #[ track_caller]
64+ fn unwrap_failed ( & self ) -> ! {
65+ bug ! ( "unexpected valtree kind, got {self:?}" )
66+ }
67+
6068 pub fn try_to_scalar ( & self ) -> Option < Scalar > {
6169 self . try_to_scalar_int ( ) . map ( Scalar :: Int )
6270 }
You can’t perform that action at this time.
0 commit comments