File tree Expand file tree Collapse file tree 2 files changed +281
-456
lines changed Expand file tree Collapse file tree 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;
2020use std:: borrow:: { Cow , IntoCow } ;
2121use std:: fmt:: { self , Debug , Formatter , Write } ;
2222use std:: { iter, u32} ;
23+ use std:: ops:: { Index , IndexMut } ;
2324
2425/// Lowered representation of a single function.
2526#[ derive( RustcEncodable , RustcDecodable ) ]
@@ -67,6 +68,22 @@ impl<'tcx> Mir<'tcx> {
6768 }
6869}
6970
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+
7087///////////////////////////////////////////////////////////////////////////
7188// Mutability and borrow kinds
7289
You can’t perform that action at this time.
0 commit comments