@@ -187,12 +187,6 @@ fn item_def_id(d: rbml::Doc, cdata: Cmd) -> DefId {
187187 translated_def_id ( cdata, reader:: get_doc ( d, tag_def_id) )
188188}
189189
190- fn get_provided_source ( d : rbml:: Doc , cdata : Cmd ) -> Option < DefId > {
191- reader:: maybe_get_doc ( d, tag_item_method_provided_source) . map ( |doc| {
192- translated_def_id ( cdata, doc)
193- } )
194- }
195-
196190fn reexports < ' a > ( d : rbml:: Doc < ' a > ) -> reader:: TaggedDocsIterator < ' a > {
197191 reader:: tagged_docs ( d, tag_items_data_item_reexport)
198192}
@@ -276,11 +270,14 @@ fn item_to_def_like(cdata: Cmd, item: rbml::Doc, did: DefId) -> DefLike {
276270 match fam {
277271 Constant => {
278272 // Check whether we have an associated const item.
279- if item_sort ( item) == Some ( 'C' ) {
280- DlDef ( def:: DefAssociatedConst ( did) )
281- } else {
282- // Regular const item.
283- DlDef ( def:: DefConst ( did) )
273+ match item_sort ( item) {
274+ Some ( 'C' ) | Some ( 'c' ) => {
275+ DlDef ( def:: DefAssociatedConst ( did) )
276+ }
277+ _ => {
278+ // Regular const item.
279+ DlDef ( def:: DefConst ( did) )
280+ }
284281 }
285282 }
286283 ImmStatic => DlDef ( def:: DefStatic ( did, false ) ) ,
@@ -818,7 +815,7 @@ pub fn get_impl_items(cdata: Cmd, impl_id: ast::NodeId)
818815 reader:: tagged_docs ( cdata. lookup_item ( impl_id) , tag_item_impl_item) . map ( |doc| {
819816 let def_id = item_def_id ( doc, cdata) ;
820817 match item_sort ( doc) {
821- Some ( 'C' ) => ty:: ConstTraitItemId ( def_id) ,
818+ Some ( 'C' ) | Some ( 'c' ) => ty:: ConstTraitItemId ( def_id) ,
822819 Some ( 'r' ) | Some ( 'p' ) => ty:: MethodTraitItemId ( def_id) ,
823820 Some ( 't' ) => ty:: TypeTraitItemId ( def_id) ,
824821 _ => panic ! ( "unknown impl item sort" ) ,
@@ -864,24 +861,22 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
864861 let vis = item_visibility ( item_doc) ;
865862
866863 match item_sort ( item_doc) {
867- Some ( 'C' ) => {
864+ sort @ Some ( 'C' ) | sort @ Some ( 'c ') => {
868865 let ty = doc_type ( item_doc, tcx, cdata) ;
869- let default = get_provided_source ( item_doc, cdata) ;
870866 ty:: ConstTraitItem ( Rc :: new ( ty:: AssociatedConst {
871867 name : name,
872868 ty : ty,
873869 vis : vis,
874870 def_id : def_id,
875871 container : container,
876- default : default ,
872+ has_value : sort == Some ( 'C' )
877873 } ) )
878874 }
879875 Some ( 'r' ) | Some ( 'p' ) => {
880876 let generics = doc_generics ( item_doc, tcx, cdata, tag_method_ty_generics) ;
881877 let predicates = doc_predicates ( item_doc, tcx, cdata, tag_method_ty_generics) ;
882878 let fty = doc_method_fty ( item_doc, tcx, cdata) ;
883879 let explicit_self = get_explicit_self ( item_doc) ;
884- let provided_source = get_provided_source ( item_doc, cdata) ;
885880
886881 ty:: MethodTraitItem ( Rc :: new ( ty:: Method :: new ( name,
887882 generics,
@@ -890,8 +885,7 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
890885 explicit_self,
891886 vis,
892887 def_id,
893- container,
894- provided_source) ) )
888+ container) ) )
895889 }
896890 Some ( 't' ) => {
897891 let ty = maybe_doc_type ( item_doc, tcx, cdata) ;
@@ -913,7 +907,7 @@ pub fn get_trait_item_def_ids(cdata: Cmd, id: ast::NodeId)
913907 reader:: tagged_docs ( item, tag_item_trait_item) . map ( |mth| {
914908 let def_id = item_def_id ( mth, cdata) ;
915909 match item_sort ( mth) {
916- Some ( 'C' ) => ty:: ConstTraitItemId ( def_id) ,
910+ Some ( 'C' ) | Some ( 'c' ) => ty:: ConstTraitItemId ( def_id) ,
917911 Some ( 'r' ) | Some ( 'p' ) => ty:: MethodTraitItemId ( def_id) ,
918912 Some ( 't' ) => ty:: TypeTraitItemId ( def_id) ,
919913 _ => panic ! ( "unknown trait item sort" ) ,
@@ -967,18 +961,19 @@ pub fn get_associated_consts<'tcx>(intr: Rc<IdentInterner>,
967961 let did = item_def_id ( ac_id, cdata) ;
968962 let ac_doc = cdata. lookup_item ( did. node ) ;
969963
970- if item_sort ( ac_doc) == Some ( 'C' ) {
971- let trait_item = get_impl_or_trait_item ( intr. clone ( ) ,
972- cdata,
973- did. node ,
974- tcx) ;
975- if let ty:: ConstTraitItem ( ref ac) = trait_item {
976- Some ( ( * ac) . clone ( ) )
977- } else {
978- None
964+ match item_sort ( ac_doc) {
965+ Some ( 'C' ) | Some ( 'c' ) => {
966+ let trait_item = get_impl_or_trait_item ( intr. clone ( ) ,
967+ cdata,
968+ did. node ,
969+ tcx) ;
970+ if let ty:: ConstTraitItem ( ref ac) = trait_item {
971+ Some ( ( * ac) . clone ( ) )
972+ } else {
973+ None
974+ }
979975 }
980- } else {
981- None
976+ _ => None
982977 }
983978 } )
984979 } ) . collect ( )
0 commit comments