|
64 | 64 |
|
65 | 65 | use middle::ty;
|
66 | 66 | use middle::typeck;
|
67 |
| -use util::ppaux::{ty_to_str, region_ptr_to_str, Repr}; |
| 67 | +use util::ppaux::{ty_to_str, Repr}; |
68 | 68 |
|
69 | 69 | use syntax::ast::{MutImmutable, MutMutable};
|
70 | 70 | use syntax::ast;
|
@@ -674,20 +674,6 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
|
674 | 674 | }
|
675 | 675 | }
|
676 | 676 |
|
677 |
| - /// inherited mutability: used in cases where the mutability of a |
678 |
| - /// component is inherited from the base it is a part of. For |
679 |
| - /// example, a record field is mutable if it is declared mutable |
680 |
| - /// or if the container is mutable. |
681 |
| - pub fn inherited_mutability(&mut self, |
682 |
| - base_m: MutabilityCategory, |
683 |
| - interior_m: ast::Mutability) |
684 |
| - -> MutabilityCategory { |
685 |
| - match interior_m { |
686 |
| - MutImmutable => base_m.inherit(), |
687 |
| - MutMutable => McDeclared |
688 |
| - } |
689 |
| - } |
690 |
| - |
691 | 677 | pub fn cat_field<N:ast_node>(&mut self,
|
692 | 678 | node: &N,
|
693 | 679 | base_cmt: cmt,
|
@@ -1114,13 +1100,6 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
|
1114 | 1100 | Ok(())
|
1115 | 1101 | }
|
1116 | 1102 |
|
1117 |
| - pub fn mut_to_str(&mut self, mutbl: ast::Mutability) -> ~str { |
1118 |
| - match mutbl { |
1119 |
| - MutMutable => ~"mutable", |
1120 |
| - MutImmutable => ~"immutable" |
1121 |
| - } |
1122 |
| - } |
1123 |
| - |
1124 | 1103 | pub fn cmt_to_str(&self, cmt: cmt) -> ~str {
|
1125 | 1104 | match cmt.cat {
|
1126 | 1105 | cat_static_item => {
|
@@ -1174,48 +1153,6 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
|
1174 | 1153 | }
|
1175 | 1154 | }
|
1176 | 1155 | }
|
1177 |
| - |
1178 |
| - pub fn region_to_str(&self, r: ty::Region) -> ~str { |
1179 |
| - region_ptr_to_str(self.tcx(), r) |
1180 |
| - } |
1181 |
| -} |
1182 |
| - |
1183 |
| -/// The node_id here is the node of the expression that references the field. |
1184 |
| -/// This function looks it up in the def map in case the type happens to be |
1185 |
| -/// an enum to determine which variant is in use. |
1186 |
| -pub fn field_mutbl(tcx: &ty::ctxt, |
1187 |
| - base_ty: ty::t, |
1188 |
| - // FIXME #6993: change type to Name |
1189 |
| - f_name: ast::Ident, |
1190 |
| - node_id: ast::NodeId) |
1191 |
| - -> Option<ast::Mutability> { |
1192 |
| - // Need to refactor so that struct/enum fields can be treated uniformly. |
1193 |
| - match ty::get(base_ty).sty { |
1194 |
| - ty::ty_struct(did, _) => { |
1195 |
| - let r = ty::lookup_struct_fields(tcx, did); |
1196 |
| - for fld in r.iter() { |
1197 |
| - if fld.name == f_name.name { |
1198 |
| - return Some(ast::MutImmutable); |
1199 |
| - } |
1200 |
| - } |
1201 |
| - } |
1202 |
| - ty::ty_enum(..) => { |
1203 |
| - match tcx.def_map.borrow().get_copy(&node_id) { |
1204 |
| - ast::DefVariant(_, variant_id, _) => { |
1205 |
| - let r = ty::lookup_struct_fields(tcx, variant_id); |
1206 |
| - for fld in r.iter() { |
1207 |
| - if fld.name == f_name.name { |
1208 |
| - return Some(ast::MutImmutable); |
1209 |
| - } |
1210 |
| - } |
1211 |
| - } |
1212 |
| - _ => {} |
1213 |
| - } |
1214 |
| - } |
1215 |
| - _ => { } |
1216 |
| - } |
1217 |
| - |
1218 |
| - return None; |
1219 | 1156 | }
|
1220 | 1157 |
|
1221 | 1158 | pub enum InteriorSafety {
|
|
0 commit comments