about summary refs log tree commit diff
path: root/src/librustc/metadata
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-05-03 18:51:58 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-05-08 17:04:00 -0700
commitdb4573a7760bd2014b2eca2537b6af15a9803e3d (patch)
treead598aad92edd9b68fa52d8635814fcce6d54dca /src/librustc/metadata
parentc7522417d48c03a110fa8839428424d6dbae1223 (diff)
downloadrust-db4573a7760bd2014b2eca2537b6af15a9803e3d.tar.gz
rust-db4573a7760bd2014b2eca2537b6af15a9803e3d.zip
librustc: Remove mutable fields from the language.
They're still parsed though, to get through bootstrapping.
Diffstat (limited to 'src/librustc/metadata')
-rw-r--r--src/librustc/metadata/decoder.rs15
-rw-r--r--src/librustc/metadata/encoder.rs23
2 files changed, 4 insertions, 34 deletions
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<int> {
     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<T> {
     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);