File tree 3 files changed +20
-2
lines changed
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 {
1433
1433
}
1434
1434
1435
1435
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
+
1436
1439
let id = match e. node {
1437
1440
ast:: ExprPath ( ..) | ast:: ExprStruct ( ..) => {
1438
1441
match cx. tcx . def_map . borrow ( ) . find ( & e. id ) {
Original file line number Diff line number Diff line change 10
10
#![ crate_id="lint_stability#0.1" ]
11
11
#![ crate_type = "lib" ]
12
12
13
+ #![ feature( macro_rules) ]
14
+ #![ macro_escape]
15
+
13
16
#[ deprecated]
14
17
pub fn deprecated ( ) { }
15
18
#[ deprecated="text" ]
@@ -173,3 +176,8 @@ pub struct StableTupleStruct(pub int);
173
176
pub struct FrozenTupleStruct ( pub int ) ;
174
177
#[ locked]
175
178
pub 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 11
11
// aux-build:lint_stability.rs
12
12
// aux-build:inherited_stability.rs
13
13
14
- #![ feature( globs) ]
14
+ #![ feature( globs, phase ) ]
15
15
#![ deny( unstable) ]
16
16
#![ deny( deprecated) ]
17
17
#![ deny( experimental) ]
18
18
#![ allow( dead_code) ]
19
19
20
20
mod cross_crate {
21
+ #[ phase( plugin, link) ]
21
22
extern crate lint_stability;
22
23
use self :: lint_stability:: * ;
23
24
@@ -76,7 +77,6 @@ mod cross_crate {
76
77
foo. method_locked_text ( ) ;
77
78
foo. trait_locked_text ( ) ;
78
79
79
-
80
80
let _ = DeprecatedStruct { i : 0 } ; //~ ERROR use of deprecated item
81
81
let _ = ExperimentalStruct { i : 0 } ; //~ ERROR use of experimental item
82
82
let _ = UnstableStruct { i : 0 } ; //~ ERROR use of unstable item
@@ -108,6 +108,13 @@ mod cross_crate {
108
108
let _ = StableTupleStruct ( 1 ) ;
109
109
let _ = FrozenTupleStruct ( 1 ) ;
110
110
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 ! ( ) ;
111
118
}
112
119
113
120
fn test_method_param < F : Trait > ( foo : F ) {
You can’t perform that action at this time.
0 commit comments