File tree 1 file changed +10
-2
lines changed
compiler/rustc_middle/src/ty/consts
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> {
42
42
43
43
impl < ' tcx > ValTreeKind < ' tcx > {
44
44
#[ inline]
45
+ #[ track_caller]
45
46
pub fn unwrap_leaf ( & self ) -> ScalarInt {
46
47
match self {
47
48
Self :: Leaf ( s) => * s,
48
- _ => bug ! ( "expected leaf, got {:?}" , self ) ,
49
+ _ => self . unwrap_failed ( ) ,
49
50
}
50
51
}
51
52
52
53
#[ inline]
54
+ #[ track_caller]
53
55
pub fn unwrap_branch ( & self ) -> & [ ValTree < ' tcx > ] {
54
56
match self {
55
57
Self :: Branch ( branch) => & * * branch,
56
- _ => bug ! ( "expected branch, got {:?}" , self ) ,
58
+ _ => self . unwrap_failed ( ) ,
57
59
}
58
60
}
59
61
62
+ #[ inline( never) ]
63
+ #[ track_caller]
64
+ fn unwrap_failed ( & self ) -> ! {
65
+ bug ! ( "unexpected valtree kind, got {self:?}" )
66
+ }
67
+
60
68
pub fn try_to_scalar ( & self ) -> Option < Scalar > {
61
69
self . try_to_scalar_int ( ) . map ( Scalar :: Int )
62
70
}
You can’t perform that action at this time.
0 commit comments