@@ -15,7 +15,7 @@ use util::ppaux::UserString;
15
15
16
16
use syntax:: ast:: * ;
17
17
use syntax:: codemap:: Span ;
18
- use syntax:: print:: pprust:: { expr_to_string , ident_to_string} ;
18
+ use syntax:: print:: pprust:: { ident_to_string} ;
19
19
use syntax:: visit:: Visitor ;
20
20
use syntax:: visit;
21
21
@@ -31,10 +31,6 @@ pub struct Context<'a,'tcx:'a> {
31
31
}
32
32
33
33
impl < ' a , ' tcx , ' v > Visitor < ' v > for Context < ' a , ' tcx > {
34
- fn visit_expr ( & mut self , ex : & Expr ) {
35
- check_expr ( self , ex) ;
36
- }
37
-
38
34
fn visit_fn ( & mut self , fk : visit:: FnKind , fd : & ' v FnDecl ,
39
35
b : & ' v Block , s : Span , n : NodeId ) {
40
36
check_fn ( self , fk, fd, b, s, n) ;
@@ -161,37 +157,6 @@ fn check_fn(
161
157
}
162
158
}
163
159
164
- pub fn check_expr ( cx : & mut Context , e : & Expr ) {
165
- debug ! ( "kind::check_expr({})" , expr_to_string( e) ) ;
166
-
167
- match e. node {
168
- ExprRepeat ( ref element, ref count_expr) => {
169
- let count = ty:: eval_repeat_count ( cx. tcx , & * * count_expr) ;
170
- if count > 1 {
171
- let element_ty = ty:: expr_ty ( cx. tcx , & * * element) ;
172
- check_copy ( cx, element_ty, element. span ,
173
- "repeated element will be copied" ) ;
174
- }
175
- }
176
- ExprAssign ( ref lhs, _) |
177
- ExprAssignOp ( _, ref lhs, _) => {
178
- let lhs_ty = ty:: expr_ty ( cx. tcx , & * * lhs) ;
179
- if !ty:: type_is_sized ( cx. tcx , lhs_ty) {
180
- cx. tcx . sess . span_err ( lhs. span , "dynamically sized type on lhs of assignment" ) ;
181
- }
182
- }
183
- ExprStruct ( ..) => {
184
- let e_ty = ty:: expr_ty ( cx. tcx , e) ;
185
- if !ty:: type_is_sized ( cx. tcx , e_ty) {
186
- cx. tcx . sess . span_err ( e. span , "trying to initialise a dynamically sized struct" ) ;
187
- }
188
- }
189
- _ => { }
190
- }
191
-
192
- visit:: walk_expr ( cx, e) ;
193
- }
194
-
195
160
fn check_ty ( cx : & mut Context , aty : & Ty ) {
196
161
match aty. node {
197
162
TyPath ( _, _, id) => {
@@ -274,18 +239,6 @@ pub fn check_freevar_bounds(cx: &Context, fn_span: Span, sp: Span, ty: ty::t,
274
239
} ) ;
275
240
}
276
241
277
- fn check_copy ( cx : & Context , ty : ty:: t , sp : Span , reason : & str ) {
278
- debug ! ( "type_contents({})={}" ,
279
- ty_to_string( cx. tcx, ty) ,
280
- ty:: type_contents( cx. tcx, ty) . to_string( ) ) ;
281
- if ty:: type_moves_by_default ( cx. tcx , ty) {
282
- span_err ! ( cx. tcx. sess, sp, E0148 ,
283
- "copying a value of non-copyable type `{}`" ,
284
- ty_to_string( cx. tcx, ty) ) ;
285
- span_note ! ( cx. tcx. sess, sp, "{}" , reason. as_slice( ) ) ;
286
- }
287
- }
288
-
289
242
// Ensure that `ty` has a statically known size (i.e., it has the `Sized` bound).
290
243
fn check_sized ( tcx : & ty:: ctxt , ty : ty:: t , name : String , sp : Span ) {
291
244
if !ty:: type_is_sized ( tcx, ty) {
0 commit comments