@@ -581,6 +581,16 @@ fn encode_visibility(rbml_w: &mut Encoder, visibility: ast::Visibility) {
581
581
rbml_w. wr_tagged_u8 ( tag_items_data_item_visibility, ch as u8 ) ;
582
582
}
583
583
584
+ fn encode_constness ( rbml_w : & mut Encoder , constness : ast:: Constness ) {
585
+ rbml_w. start_tag ( tag_items_data_item_constness) ;
586
+ let ch = match constness {
587
+ ast:: Constness :: Const => 'c' ,
588
+ ast:: Constness :: NotConst => 'n' ,
589
+ } ;
590
+ rbml_w. wr_str ( & ch. to_string ( ) ) ;
591
+ rbml_w. end_tag ( ) ;
592
+ }
593
+
584
594
fn encode_explicit_self ( rbml_w : & mut Encoder ,
585
595
explicit_self : & ty:: ExplicitSelfCategory ) {
586
596
let tag = tag_item_trait_method_explicit_self;
@@ -867,10 +877,14 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
867
877
encode_attributes ( rbml_w, & impl_item. attrs ) ;
868
878
let scheme = ty:: lookup_item_type ( ecx. tcx , m. def_id ) ;
869
879
let any_types = !scheme. generics . types . is_empty ( ) ;
870
- if any_types || is_default_impl || attr:: requests_inline ( & impl_item. attrs ) {
880
+ let needs_inline = any_types || is_default_impl ||
881
+ attr:: requests_inline ( & impl_item. attrs ) ;
882
+ let constness = ast_method. pe_constness ( ) ;
883
+ if needs_inline || constness == ast:: Constness :: Const {
871
884
encode_inlined_item ( ecx, rbml_w, IIImplItemRef ( local_def ( parent_id) ,
872
885
impl_item) ) ;
873
886
}
887
+ encode_constness ( rbml_w, constness) ;
874
888
if !any_types {
875
889
encode_symbol ( ecx, rbml_w, m. def_id . node ) ;
876
890
}
@@ -1049,7 +1063,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
1049
1063
encode_stability ( rbml_w, stab) ;
1050
1064
rbml_w. end_tag ( ) ;
1051
1065
}
1052
- ast:: ItemFn ( ref decl, _, _ , _, ref generics, _) => {
1066
+ ast:: ItemFn ( ref decl, _, constness , _, ref generics, _) => {
1053
1067
add_to_index ( item, rbml_w, index) ;
1054
1068
rbml_w. start_tag ( tag_items_data_item) ;
1055
1069
encode_def_id ( rbml_w, def_id) ;
@@ -1059,12 +1073,14 @@ fn encode_info_for_item(ecx: &EncodeContext,
1059
1073
encode_name ( rbml_w, item. ident . name ) ;
1060
1074
encode_path ( rbml_w, path) ;
1061
1075
encode_attributes ( rbml_w, & item. attrs ) ;
1062
- if tps_len > 0 || attr:: requests_inline ( & item. attrs ) {
1076
+ let needs_inline = tps_len > 0 || attr:: requests_inline ( & item. attrs ) ;
1077
+ if needs_inline || constness == ast:: Constness :: Const {
1063
1078
encode_inlined_item ( ecx, rbml_w, IIItemRef ( item) ) ;
1064
1079
}
1065
1080
if tps_len == 0 {
1066
1081
encode_symbol ( ecx, rbml_w, item. id ) ;
1067
1082
}
1083
+ encode_constness ( rbml_w, constness) ;
1068
1084
encode_visibility ( rbml_w, vis) ;
1069
1085
encode_stability ( rbml_w, stab) ;
1070
1086
encode_method_argument_names ( rbml_w, & * * decl) ;
0 commit comments