File tree 2 files changed +281
-456
lines changed
2 files changed +281
-456
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ use syntax::codemap::Span;
20
20
use std:: borrow:: { Cow , IntoCow } ;
21
21
use std:: fmt:: { self , Debug , Formatter , Write } ;
22
22
use std:: { iter, u32} ;
23
+ use std:: ops:: { Index , IndexMut } ;
23
24
24
25
/// Lowered representation of a single function.
25
26
#[ derive( RustcEncodable , RustcDecodable ) ]
@@ -67,6 +68,22 @@ impl<'tcx> Mir<'tcx> {
67
68
}
68
69
}
69
70
71
+ impl < ' tcx > Index < BasicBlock > for Mir < ' tcx > {
72
+ type Output = BasicBlockData < ' tcx > ;
73
+
74
+ #[ inline]
75
+ fn index ( & self , index : BasicBlock ) -> & BasicBlockData < ' tcx > {
76
+ self . basic_block_data ( index)
77
+ }
78
+ }
79
+
80
+ impl < ' tcx > IndexMut < BasicBlock > for Mir < ' tcx > {
81
+ #[ inline]
82
+ fn index_mut ( & mut self , index : BasicBlock ) -> & mut BasicBlockData < ' tcx > {
83
+ self . basic_block_data_mut ( index)
84
+ }
85
+ }
86
+
70
87
///////////////////////////////////////////////////////////////////////////
71
88
// Mutability and borrow kinds
72
89
You can’t perform that action at this time.
0 commit comments