@@ -399,16 +399,15 @@ fn test_scope(cx: ctx, sc: scope, r: restrict, p: ast::path) {
399
399
_ { }
400
400
}
401
401
if prob != valid && cant_copy ( cx, r) {
402
- let msg =
403
- alt prob {
404
- overwritten( sp, wpt) {
405
- { span: sp, msg: "overwriting " + ast_util:: path_name ( wpt) }
406
- }
407
- val_taken ( sp, vpt) {
408
- { span: sp,
409
- msg: "taking the value of " + ast_util:: path_name ( vpt) }
410
- }
411
- } ;
402
+ let msg = alt prob {
403
+ overwritten( sp, wpt) {
404
+ { span: sp, msg: "overwriting " + ast_util:: path_name ( wpt) }
405
+ }
406
+ val_taken ( sp, vpt) {
407
+ { span: sp,
408
+ msg: "taking the value of " + ast_util:: path_name ( vpt) }
409
+ }
410
+ } ;
412
411
cx. tcx . sess . span_err ( msg. span ,
413
412
msg. msg + " will invalidate reference " +
414
413
ast_util:: path_name ( p) +
@@ -515,7 +514,7 @@ fn copy_is_expensive(tcx: ty::ctxt, ty: ty::t) -> bool {
515
514
ty:: ty_constr ( t, _) | ty:: ty_res ( _, t, _) { score_ty ( tcx, t) }
516
515
ty:: ty_fn ( _, _, _, _, _) | ty:: ty_native_fn ( _, _, _) |
517
516
ty:: ty_obj ( _) { 4 u }
518
- ty:: ty_str. | ty:: ty_vec ( _) { 50 u }
517
+ ty:: ty_str. | ty:: ty_vec ( _) | ty :: ty_param ( _ , _ ) { 50 u }
519
518
ty:: ty_uniq ( t) { 1 u + score_ty ( tcx, t) }
520
519
ty:: ty_tag ( _, ts) | ty:: ty_tup ( ts) {
521
520
let sum = 0 u;
@@ -527,7 +526,6 @@ fn copy_is_expensive(tcx: ty::ctxt, ty: ty::t) -> bool {
527
526
for f in fs { sum += score_ty ( tcx, f. mt . ty ) ; }
528
527
sum
529
528
}
530
- ty:: ty_param ( _, _) { 5 u }
531
529
} ;
532
530
}
533
531
ret score_ty( tcx, ty) > 8 u;
0 commit comments