From db4573a7760bd2014b2eca2537b6af15a9803e3d Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 3 May 2013 18:51:58 -0700 Subject: librustc: Remove mutable fields from the language. They're still parsed though, to get through bootstrapping. --- src/librustc/metadata/decoder.rs | 15 --------------- src/librustc/metadata/encoder.rs | 23 ++++------------------- 2 files changed, 4 insertions(+), 34 deletions(-) (limited to 'src/librustc/metadata') diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 1e6bb397068..fd35a4425d8 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -204,18 +204,6 @@ fn each_reexport(d: ebml::Doc, f: &fn(ebml::Doc) -> bool) { } } -fn field_mutability(d: ebml::Doc) -> ast::struct_mutability { - // Use maybe_get_doc in case it's a method - reader::maybe_get_doc(d, tag_struct_mut).map_default( - ast::struct_immutable, - |d| { - match reader::doc_as_u8(*d) as char { - 'm' => ast::struct_mutable, - _ => ast::struct_immutable - } - }) -} - fn variant_disr_val(d: ebml::Doc) -> Option { do reader::maybe_get_doc(d, tag_disr_val).chain |val_doc| { int::parse_bytes(reader::doc_data(val_doc), 10u) @@ -923,12 +911,10 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id) if f == PublicField || f == PrivateField || f == InheritedField { let name = item_name(intr, an_item); let did = item_def_id(an_item, cdata); - let mt = field_mutability(an_item); result.push(ty::field_ty { ident: name, id: did, vis: struct_field_family_to_visibility(f), - mutability: mt, }); } } @@ -938,7 +924,6 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id) ident: special_idents::unnamed_field, id: did, vis: ast::inherited, - mutability: ast::struct_immutable, }); } result diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index c84bebdfd39..87ccd1e45b6 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -119,16 +119,6 @@ fn encode_region_param(ecx: @EncodeContext, } } -fn encode_mutability(ebml_w: &mut writer::Encoder, mt: struct_mutability) { - ebml_w.start_tag(tag_struct_mut); - let val = match mt { - struct_immutable => 'a', - struct_mutable => 'm' - }; - ebml_w.writer.write(&[val as u8]); - ebml_w.end_tag(); -} - struct entry { val: T, pos: uint @@ -518,13 +508,9 @@ fn encode_info_for_struct(ecx: @EncodeContext, /* We encode both private and public fields -- need to include private fields to get the offsets right */ for fields.each |field| { - let (nm, mt, vis) = match field.node.kind { - named_field(nm, mt, vis) => (nm, mt, vis), - unnamed_field => ( - special_idents::unnamed_field, - struct_immutable, - inherited - ) + let (nm, vis) = match field.node.kind { + named_field(nm, vis) => (nm, vis), + unnamed_field => (special_idents::unnamed_field, inherited) }; let id = field.node.id; @@ -537,7 +523,6 @@ fn encode_info_for_struct(ecx: @EncodeContext, encode_name(ecx, ebml_w, nm); encode_path(ecx, ebml_w, path, ast_map::path_name(nm)); encode_type(ecx, ebml_w, node_id_to_type(tcx, id)); - encode_mutability(ebml_w, mt); encode_def_id(ebml_w, local_def(id)); ebml_w.end_tag(); } @@ -828,7 +813,7 @@ fn encode_info_for_item(ecx: @EncodeContext, needs to know*/ for struct_def.fields.each |f| { match f.node.kind { - named_field(ident, _, vis) => { + named_field(ident, vis) => { ebml_w.start_tag(tag_item_field); encode_struct_field_family(ebml_w, vis); encode_name(ecx, ebml_w, ident); -- cgit 1.4.1-3-g733a5