File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ impl Span {
270
270
/// `self` was generated from, if any.
271
271
#[ unstable( feature = "proc_macro" , issue = "38356" ) ]
272
272
pub fn parent ( & self ) -> Option < Span > {
273
- self . 0 . ctxt ( ) . outer ( ) . expn_info ( ) . map ( |i| Span ( i . call_site ) )
273
+ self . 0 . parent ( ) . map ( |x| { Span ( x ) } )
274
274
}
275
275
276
276
/// The span for the origin source code that `self` was generated from. If
Original file line number Diff line number Diff line change @@ -291,6 +291,12 @@ impl Span {
291
291
self . ctxt ( ) . outer ( ) . expn_info ( ) . map ( |info| info. call_site . source_callsite ( ) ) . unwrap_or ( self )
292
292
}
293
293
294
+ /// The `Span for the tokens in the previous macro expansion from which `self` was generated,
295
+ /// if any
296
+ pub fn parent ( self ) -> Option < Span > {
297
+ self . ctxt ( ) . outer ( ) . expn_info ( ) . map ( |i| i. call_site )
298
+ }
299
+
294
300
/// Return the source callee.
295
301
///
296
302
/// Returns None if the supplied span has no expansion trace,
You can’t perform that action at this time.
0 commit comments