@@ -8,31 +8,19 @@ enum option {
8
8
ctypes;
9
9
}
10
10
11
- fn check_crate ( tcx : ty:: ctxt , crate : @ast:: crate ,
12
- checks : [ option ] , timer : block ( str , fn @( ) ) ) {
13
- let ccx = @{ tcx: tcx} ;
14
- vec:: iter ( checks) { |c|
15
- alt c {
16
- ctypes {
17
- timer( "ctypes usage checking" , bind check_ctypes ( ccx, crate ) )
18
- }
19
- }
20
- }
21
- }
22
-
23
- fn check_ctypes ( ccx : @crate_ctxt , crate : @ast:: crate ) {
24
- fn check_native_fn ( ccx : @crate_ctxt , decl : ast:: fn_decl ) {
11
+ fn check_ctypes ( tcx : ty:: ctxt , crate : @ast:: crate ) {
12
+ fn check_native_fn ( tcx : ty:: ctxt , decl : ast:: fn_decl ) {
25
13
let tys = vec:: map ( decl. inputs ) { |a| a. ty } ;
26
14
for ty in ( tys + [ decl. output ] ) {
27
15
alt ty. node {
28
16
ast:: ty_int ( ast:: ty_i) {
29
- ccx . tcx . sess . span_warn (
17
+ tcx. sess . span_warn (
30
18
ty. span ,
31
19
"found rust type `int` in native module, while \
32
20
ctypes::c_int or ctypes::long should be used") ;
33
21
}
34
22
ast:: ty_uint ( ast:: ty_u) {
35
- ccx . tcx . sess . span_warn (
23
+ tcx. sess . span_warn (
36
24
ty. span ,
37
25
"found rust type `uint` in native module, while \
38
26
ctypes::c_uint or ctypes::ulong should be used") ;
@@ -42,13 +30,13 @@ fn check_ctypes(ccx: @crate_ctxt, crate: @ast::crate) {
42
30
}
43
31
}
44
32
45
- fn check_item ( ccx : @ crate_ctxt , it : @ast:: item ) {
33
+ fn check_item ( tcx : ty :: ctxt , it : @ast:: item ) {
46
34
alt it. node {
47
35
ast:: item_native_mod ( nmod) {
48
36
for ni in nmod. items {
49
37
alt ni. node {
50
38
ast:: native_item_fn ( decl, tps) {
51
- check_native_fn ( ccx , decl) ;
39
+ check_native_fn ( tcx , decl) ;
52
40
}
53
41
_ { }
54
42
}
@@ -59,7 +47,7 @@ fn check_ctypes(ccx: @crate_ctxt, crate: @ast::crate) {
59
47
}
60
48
61
49
let visit = visit:: mk_simple_visitor ( @{
62
- visit_item: bind check_item ( ccx , _)
50
+ visit_item: bind check_item ( tcx , _)
63
51
with * visit:: default_simple_visitor ( )
64
52
} ) ;
65
53
visit:: visit_crate ( * crate , ( ) , visit) ;
0 commit comments