Remove outdated errors for mutating strings

This commit is contained in:
Ariel Ben-Yehuda 2015-07-04 15:30:00 +03:00
parent 0dc08240ea
commit 90fcf261f2
4 changed files with 40 additions and 28 deletions

View file

@ -1205,8 +1205,8 @@ register_diagnostics! {
E0017,
E0022,
E0038,
E0134,
E0135,
// E0134,
// E0135,
E0136,
E0138,
E0139,

View file

@ -59,26 +59,6 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
UnsafeFn => {}
}
}
fn check_str_index(&mut self, e: &ast::Expr) {
let base_type = match e.node {
ast::ExprIndex(ref base, _) => self.tcx.node_id_to_type(base.id),
_ => return
};
debug!("effect: checking index with base type {:?}",
base_type);
match base_type.sty {
ty::TyBox(ty) | ty::TyRef(_, ty::mt{ty, ..}) => if ty::TyStr == ty.sty {
span_err!(self.tcx.sess, e.span, E0134,
"modification of string types is not allowed");
},
ty::TyStr => {
span_err!(self.tcx.sess, e.span, E0135,
"modification of string types is not allowed");
}
_ => {}
}
}
}
impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
@ -164,12 +144,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
self.require_unsafe(expr.span, "dereference of raw pointer")
}
}
ast::ExprAssign(ref base, _) | ast::ExprAssignOp(_, ref base, _) => {
self.check_str_index(&**base);
}
ast::ExprAddrOf(ast::MutMutable, ref base) => {
self.check_str_index(&**base);
}
ast::ExprInlineAsm(..) => {
self.require_unsafe(expr.span, "use of inline assembly");
}