@@ -1205,7 +1205,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
12051205 None => { }
12061206 }
12071207 }
1208- ast:: ItemImpl ( _, ref opt_trait, ref ty, ref ast_items) => {
1208+ ast:: ItemImpl ( unsafety , _, ref opt_trait, ref ty, ref ast_items) => {
12091209 // We need to encode information about the default methods we
12101210 // have inherited, so we drive this based on the impl structure.
12111211 let impl_items = tcx. impl_items . borrow ( ) ;
@@ -1218,6 +1218,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
12181218 encode_bounds_and_type ( rbml_w, ecx, & lookup_item_type ( tcx, def_id) ) ;
12191219 encode_name ( rbml_w, item. ident . name ) ;
12201220 encode_attributes ( rbml_w, item. attrs . as_slice ( ) ) ;
1221+ encode_unsafety ( rbml_w, unsafety) ;
12211222 match ty. node {
12221223 ast:: TyPath ( ref path, _) if path. segments
12231224 . len ( ) == 1 => {
@@ -1308,13 +1309,14 @@ fn encode_info_for_item(ecx: &EncodeContext,
13081309 }
13091310 }
13101311 }
1311- ast:: ItemTrait ( _, _, _, ref ms) => {
1312+ ast:: ItemTrait ( _, _, _, _ , ref ms) => {
13121313 add_to_index ( item, rbml_w, index) ;
13131314 rbml_w. start_tag ( tag_items_data_item) ;
13141315 encode_def_id ( rbml_w, def_id) ;
13151316 encode_family ( rbml_w, 'I' ) ;
13161317 encode_item_variances ( rbml_w, ecx, item. id ) ;
13171318 let trait_def = ty:: lookup_trait_def ( tcx, def_id) ;
1319+ encode_unsafety ( rbml_w, trait_def. unsafety ) ;
13181320 encode_generics ( rbml_w, ecx, & trait_def. generics , tag_item_generics) ;
13191321 encode_trait_ref ( rbml_w, ecx, & * trait_def. trait_ref , tag_item_trait_ref) ;
13201322 encode_name ( rbml_w, item. ident . name ) ;
@@ -1674,6 +1676,14 @@ fn encode_attributes(rbml_w: &mut Encoder, attrs: &[ast::Attribute]) {
16741676 rbml_w. end_tag ( ) ;
16751677}
16761678
1679+ fn encode_unsafety ( rbml_w : & mut Encoder , unsafety : ast:: Unsafety ) {
1680+ let byte: u8 = match unsafety {
1681+ ast:: Unsafety :: Normal => 0 ,
1682+ ast:: Unsafety :: Unsafe => 1 ,
1683+ } ;
1684+ rbml_w. wr_tagged_u8 ( tag_unsafety, byte) ;
1685+ }
1686+
16771687fn encode_crate_deps ( rbml_w : & mut Encoder , cstore : & cstore:: CStore ) {
16781688 fn get_ordered_deps ( cstore : & cstore:: CStore ) -> Vec < decoder:: CrateDep > {
16791689 // Pull the cnums and name,vers,hash out of cstore
@@ -1855,7 +1865,7 @@ struct ImplVisitor<'a, 'b:'a, 'c:'a, 'tcx:'b> {
18551865
18561866impl < ' a , ' b , ' c , ' tcx , ' v > Visitor < ' v > for ImplVisitor < ' a , ' b , ' c , ' tcx > {
18571867 fn visit_item ( & mut self , item : & ast:: Item ) {
1858- if let ast:: ItemImpl ( _, Some ( ref trait_ref) , _, _) = item. node {
1868+ if let ast:: ItemImpl ( _, _ , Some ( ref trait_ref) , _, _) = item. node {
18591869 let def_map = & self . ecx . tcx . def_map ;
18601870 let trait_def = def_map. borrow ( ) [ trait_ref. ref_id ] . clone ( ) ;
18611871 let def_id = trait_def. def_id ( ) ;
0 commit comments