@@ -47,6 +47,7 @@ enum lint {
47
47
non_implicitly_copyable_typarams,
48
48
vecs_not_implicitly_copyable,
49
49
implicit_copies,
50
+ old_strs,
50
51
}
51
52
52
53
// This is pretty unfortunate. We really want some sort of "deriving Enum"
@@ -62,6 +63,7 @@ fn int_to_lint(i: int) -> lint {
62
63
6 { non_implicitly_copyable_typarams }
63
64
7 { vecs_not_implicitly_copyable }
64
65
8 { implicit_copies }
66
+ 9 { old_strs }
65
67
}
66
68
}
67
69
@@ -103,7 +105,12 @@ fn get_lint_dict() -> lint_dict {
103
105
104
106
( "old_vecs" ,
105
107
@{ lint: old_vecs,
106
- desc: "old (deprecated) vectors and strings" ,
108
+ desc: "old (deprecated) vectors" ,
109
+ default : warn} ) ,
110
+
111
+ ( "old_strs" ,
112
+ @{ lint: old_strs,
113
+ desc: "old (deprecated) strings" ,
107
114
default : ignore} ) ,
108
115
109
116
( "unrecognized_warning" ,
@@ -419,13 +426,19 @@ fn check_item_old_vecs(cx: ty::ctxt, it: @ast::item) {
419
426
420
427
visit_expr: fn @( e: @ast:: expr) {
421
428
alt e. node {
422
- ast:: expr_vec( _, _) |
423
- ast:: expr_lit( @{ node: ast:: lit_str( _) , span: _} )
429
+ ast:: expr_vec( _, _)
424
430
if ! uses_vstore. contains_key( e. id) {
425
431
cx. sess. span_lint(
426
432
old_vecs, e. id, it. id,
427
- e. span, "deprecated vec/ str expr") ;
433
+ e. span, "deprecated vec expr") ;
428
434
}
435
+ ast:: expr_lit( @{ node: ast:: lit_str( _) , span: _} )
436
+ if ! uses_vstore. contains_key( e. id) {
437
+ cx. sess. span_lint(
438
+ old_strs, e. id, it. id,
439
+ e. span, "deprecated str expr") ;
440
+ }
441
+
429
442
ast:: expr_vstore( @inner, _) {
430
443
uses_vstore. insert( inner. id, true) ;
431
444
}
@@ -441,15 +454,13 @@ fn check_item_old_vecs(cx: ty::ctxt, it: @ast::item) {
441
454
old_vecs, t. id, it. id,
442
455
t. span, "deprecated vec type ") ;
443
456
}
444
-
445
457
ast:: ty_path( @{ span: _, global: _, idents: ids,
446
458
rp: none, types: _} , _)
447
459
if ids == [ @"str "] && ( ! uses_vstore. contains_key( t. id) ) {
448
460
cx. sess. span_lint(
449
- old_vecs , t. id, it. id,
461
+ old_strs , t. id, it. id,
450
462
t. span, "deprecated str type ") ;
451
463
}
452
-
453
464
ast:: ty_vstore( inner, _) {
454
465
uses_vstore. insert( inner. id, true) ;
455
466
}
0 commit comments