@@ -53,6 +53,7 @@ enum lint {
53
53
deprecated_mode,
54
54
deprecated_pattern,
55
55
non_camel_case_types,
56
+ structural_records,
56
57
57
58
managed_heap_memory,
58
59
owned_heap_memory,
@@ -171,6 +172,11 @@ fn get_lint_dict() -> lint_dict {
171
172
desc: ~"use of any ( ~ type or @ type ) heap memory",
172
173
default : allow} ) ,
173
174
175
+ ( ~"structural_records",
176
+ @{ lint: structural_records,
177
+ desc: ~"use of any structural records",
178
+ default : allow} ) ,
179
+
174
180
/* FIXME(#3266)--make liveness warnings lintable
175
181
(~"unused_variable",
176
182
@{lint: unused_variable,
@@ -380,6 +386,7 @@ fn check_item(i: @ast::item, cx: ty::ctxt) {
380
386
check_item_path_statement( cx, i) ;
381
387
check_item_non_camel_case_types( cx, i) ;
382
388
check_item_heap( cx, i) ;
389
+ check_item_structural_records( cx, i) ;
383
390
}
384
391
385
392
// Take a visitor, and modify it so that it will not proceed past subitems.
@@ -413,6 +420,23 @@ fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {
413
420
visit:: visit_item( it, ( ) , visit) ;
414
421
}
415
422
423
+ fn check_item_structural_records( cx: ty:: ctxt, it: @ast:: item) {
424
+ let visit = item_stopping_visitor( visit:: mk_simple_visitor( @{
425
+ visit_expr: fn @( e: @ast:: expr) {
426
+ match e. node {
427
+ ast:: expr_rec( * ) =>
428
+ cx. sess. span_lint(
429
+ structural_records, e. id, it. id,
430
+ e. span,
431
+ ~"structural records are deprecated") ,
432
+ _ => ( )
433
+ }
434
+ } ,
435
+ .. * visit:: default_simple_visitor( )
436
+ } ) ) ;
437
+ visit:: visit_item( it, ( ) , visit) ;
438
+ }
439
+
416
440
fn check_item_ctypes( cx: ty:: ctxt, it: @ast:: item) {
417
441
418
442
fn check_foreign_fn( cx: ty:: ctxt, fn_id: ast:: node_id,
0 commit comments