File tree Expand file tree Collapse file tree 3 files changed +7
-11
lines changed Expand file tree Collapse file tree 3 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -494,11 +494,3 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
494
494
ExpnKind :: Macro ( ..) => true , // definitely a plugin
495
495
}
496
496
}
497
-
498
- /// Returns `true` if `span` originates in a derive-macro's expansion.
499
- pub fn in_derive_expansion ( span : Span ) -> bool {
500
- if let ExpnKind :: Macro ( MacroKind :: Derive , _) = span. ctxt ( ) . outer_expn_data ( ) . kind {
501
- return true ;
502
- }
503
- false
504
- }
Original file line number Diff line number Diff line change 3
3
4
4
pub use self :: StabilityLevel :: * ;
5
5
6
- use crate :: lint:: in_derive_expansion;
7
6
use crate :: session:: { DiagnosticMessageId , Session } ;
8
7
use crate :: ty:: { self , TyCtxt } ;
9
8
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
@@ -201,7 +200,7 @@ pub fn early_report_deprecation(
201
200
lint : & ' static Lint ,
202
201
span : Span ,
203
202
) {
204
- if in_derive_expansion ( span ) {
203
+ if span . in_derive_expansion ( ) {
205
204
return ;
206
205
}
207
206
@@ -218,7 +217,7 @@ fn late_report_deprecation(
218
217
def_id : DefId ,
219
218
hir_id : HirId ,
220
219
) {
221
- if in_derive_expansion ( span ) {
220
+ if span . in_derive_expansion ( ) {
222
221
return ;
223
222
}
224
223
Original file line number Diff line number Diff line change @@ -309,6 +309,11 @@ impl Span {
309
309
self . ctxt ( ) != SyntaxContext :: root ( )
310
310
}
311
311
312
+ /// Returns `true` if `span` originates in a derive-macro's expansion.
313
+ pub fn in_derive_expansion ( self ) -> bool {
314
+ matches ! ( self . ctxt( ) . outer_expn_data( ) . kind, ExpnKind :: Macro ( MacroKind :: Derive , _) )
315
+ }
316
+
312
317
#[ inline]
313
318
pub fn with_root_ctxt ( lo : BytePos , hi : BytePos ) -> Span {
314
319
Span :: new ( lo, hi, SyntaxContext :: root ( ) )
You can’t perform that action at this time.
0 commit comments