File tree 1 file changed +10
-2
lines changed
compiler/rustc_middle/src/ty
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ pub use valtree::*;
19
19
#[ rustc_pass_by_value]
20
20
pub struct Const < ' tcx > ( pub Interned < ' tcx , ConstS < ' tcx > > ) ;
21
21
22
+ impl < ' tcx > std:: ops:: Deref for Const < ' tcx > {
23
+ type Target = ConstS < ' tcx > ;
24
+
25
+ fn deref ( & self ) -> & Self :: Target {
26
+ & self . 0 . 0
27
+ }
28
+ }
29
+
22
30
impl < ' tcx > fmt:: Debug for Const < ' tcx > {
23
31
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
24
32
// This reflects what `Const` looked liked before `Interned` was
@@ -41,12 +49,12 @@ static_assert_size!(ConstS<'_>, 40);
41
49
impl < ' tcx > Const < ' tcx > {
42
50
#[ inline]
43
51
pub fn ty ( self ) -> Ty < ' tcx > {
44
- self . 0 . ty
52
+ self . ty
45
53
}
46
54
47
55
#[ inline]
48
56
pub fn kind ( self ) -> ConstKind < ' tcx > {
49
- self . 0 . kind
57
+ self . kind
50
58
}
51
59
52
60
/// Literals and const generic parameters are eagerly converted to a constant, everything else
You can’t perform that action at this time.
0 commit comments