File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -1433,6 +1433,9 @@ impl LintPass for Stability {
14331433 }
14341434
14351435 fn check_expr ( & mut self , cx : & Context , e : & ast:: Expr ) {
1436+ // if the expression was produced by a macro expansion,
1437+ if e. span . expn_info . is_some ( ) { return }
1438+
14361439 let id = match e. node {
14371440 ast:: ExprPath ( ..) | ast:: ExprStruct ( ..) => {
14381441 match cx. tcx . def_map . borrow ( ) . find ( & e. id ) {
Original file line number Diff line number Diff line change 1010#![ crate_id="lint_stability#0.1" ]
1111#![ crate_type = "lib" ]
1212
13+ #![ feature( macro_rules) ]
14+ #![ macro_escape]
15+
1316#[ deprecated]
1417pub fn deprecated ( ) { }
1518#[ deprecated="text" ]
@@ -173,3 +176,8 @@ pub struct StableTupleStruct(pub int);
173176pub struct FrozenTupleStruct ( pub int ) ;
174177#[ locked]
175178pub struct LockedTupleStruct ( pub int ) ;
179+
180+ #[ macro_export]
181+ macro_rules! macro_test(
182+ ( ) => ( deprecated( ) ) ;
183+ )
Original file line number Diff line number Diff line change 1111// aux-build:lint_stability.rs
1212// aux-build:inherited_stability.rs
1313
14- #![ feature( globs) ]
14+ #![ feature( globs, phase ) ]
1515#![ deny( unstable) ]
1616#![ deny( deprecated) ]
1717#![ deny( experimental) ]
1818#![ allow( dead_code) ]
1919
2020mod cross_crate {
21+ #[ phase( plugin, link) ]
2122 extern crate lint_stability;
2223 use self :: lint_stability:: * ;
2324
@@ -76,7 +77,6 @@ mod cross_crate {
7677 foo. method_locked_text ( ) ;
7778 foo. trait_locked_text ( ) ;
7879
79-
8080 let _ = DeprecatedStruct { i : 0 } ; //~ ERROR use of deprecated item
8181 let _ = ExperimentalStruct { i : 0 } ; //~ ERROR use of experimental item
8282 let _ = UnstableStruct { i : 0 } ; //~ ERROR use of unstable item
@@ -108,6 +108,13 @@ mod cross_crate {
108108 let _ = StableTupleStruct ( 1 ) ;
109109 let _ = FrozenTupleStruct ( 1 ) ;
110110 let _ = LockedTupleStruct ( 1 ) ;
111+
112+ // At the moment, the following just checks that the stability
113+ // level of expanded code does not trigger the
114+ // lint. Eventually, we will want to lint the contents of the
115+ // macro in the module *defining* it. Also, stability levels
116+ // on macros themselves are not yet linted.
117+ macro_test ! ( ) ;
111118 }
112119
113120 fn test_method_param < F : Trait > ( foo : F ) {
You can’t perform that action at this time.
0 commit comments