@@ -1205,7 +1205,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
1205
1205
None => { }
1206
1206
}
1207
1207
}
1208
- ast:: ItemImpl ( _, ref opt_trait, ref ty, ref ast_items) => {
1208
+ ast:: ItemImpl ( unsafety , _, ref opt_trait, ref ty, ref ast_items) => {
1209
1209
// We need to encode information about the default methods we
1210
1210
// have inherited, so we drive this based on the impl structure.
1211
1211
let impl_items = tcx. impl_items . borrow ( ) ;
@@ -1218,6 +1218,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
1218
1218
encode_bounds_and_type ( rbml_w, ecx, & lookup_item_type ( tcx, def_id) ) ;
1219
1219
encode_name ( rbml_w, item. ident . name ) ;
1220
1220
encode_attributes ( rbml_w, item. attrs . as_slice ( ) ) ;
1221
+ encode_unsafety ( rbml_w, unsafety) ;
1221
1222
match ty. node {
1222
1223
ast:: TyPath ( ref path, _) if path. segments
1223
1224
. len ( ) == 1 => {
@@ -1308,13 +1309,14 @@ fn encode_info_for_item(ecx: &EncodeContext,
1308
1309
}
1309
1310
}
1310
1311
}
1311
- ast:: ItemTrait ( _, _, _, ref ms) => {
1312
+ ast:: ItemTrait ( _, _, _, _ , ref ms) => {
1312
1313
add_to_index ( item, rbml_w, index) ;
1313
1314
rbml_w. start_tag ( tag_items_data_item) ;
1314
1315
encode_def_id ( rbml_w, def_id) ;
1315
1316
encode_family ( rbml_w, 'I' ) ;
1316
1317
encode_item_variances ( rbml_w, ecx, item. id ) ;
1317
1318
let trait_def = ty:: lookup_trait_def ( tcx, def_id) ;
1319
+ encode_unsafety ( rbml_w, trait_def. unsafety ) ;
1318
1320
encode_generics ( rbml_w, ecx, & trait_def. generics , tag_item_generics) ;
1319
1321
encode_trait_ref ( rbml_w, ecx, & * trait_def. trait_ref , tag_item_trait_ref) ;
1320
1322
encode_name ( rbml_w, item. ident . name ) ;
@@ -1674,6 +1676,14 @@ fn encode_attributes(rbml_w: &mut Encoder, attrs: &[ast::Attribute]) {
1674
1676
rbml_w. end_tag ( ) ;
1675
1677
}
1676
1678
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
+
1677
1687
fn encode_crate_deps ( rbml_w : & mut Encoder , cstore : & cstore:: CStore ) {
1678
1688
fn get_ordered_deps ( cstore : & cstore:: CStore ) -> Vec < decoder:: CrateDep > {
1679
1689
// Pull the cnums and name,vers,hash out of cstore
@@ -1855,7 +1865,7 @@ struct ImplVisitor<'a, 'b:'a, 'c:'a, 'tcx:'b> {
1855
1865
1856
1866
impl < ' a , ' b , ' c , ' tcx , ' v > Visitor < ' v > for ImplVisitor < ' a , ' b , ' c , ' tcx > {
1857
1867
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 {
1859
1869
let def_map = & self . ecx . tcx . def_map ;
1860
1870
let trait_def = def_map. borrow ( ) [ trait_ref. ref_id ] . clone ( ) ;
1861
1871
let def_id = trait_def. def_id ( ) ;
0 commit comments