@@ -8,13 +8,13 @@ extern crate rustc_hir;
88extern crate rustc_lint;
99#[ macro_use]
1010extern crate rustc_session;
11- extern crate rustc_span;
1211extern crate rustc_ast;
12+ extern crate rustc_span;
1313
1414use rustc_driver:: plugin:: Registry ;
15- use rustc_lint:: { LateContext , LateLintPass , LintArray , LintContext , LintPass } ;
15+ use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
16+ use rustc_span:: def_id:: CRATE_DEF_ID ;
1617use rustc_span:: symbol:: Symbol ;
17- use rustc_ast:: attr;
1818
1919declare_lint ! {
2020 CRATE_NOT_OKAY ,
@@ -25,13 +25,12 @@ declare_lint! {
2525declare_lint_pass ! ( Pass => [ CRATE_NOT_OKAY ] ) ;
2626
2727impl < ' tcx > LateLintPass < ' tcx > for Pass {
28- fn check_crate ( & mut self , cx : & LateContext , krate : & rustc_hir :: Crate ) {
28+ fn check_crate ( & mut self , cx : & LateContext ) {
2929 let attrs = cx. tcx . hir ( ) . attrs ( rustc_hir:: CRATE_HIR_ID ) ;
30+ let span = cx. tcx . def_span ( CRATE_DEF_ID ) ;
3031 if !cx. sess ( ) . contains_name ( attrs, Symbol :: intern ( "crate_okay" ) ) {
3132 cx. lint ( CRATE_NOT_OKAY , |lint| {
32- lint. build ( "crate is not marked with #![crate_okay]" )
33- . set_span ( krate. module ( ) . inner )
34- . emit ( )
33+ lint. build ( "crate is not marked with #![crate_okay]" ) . set_span ( span) . emit ( )
3534 } ) ;
3635 }
3736 }
0 commit comments