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 {
270270 /// `self` was generated from, if any.
271271 #[ unstable( feature = "proc_macro" , issue = "38356" ) ]
272272 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 ) } )
274274 }
275275
276276 /// 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 {
291291 self . ctxt ( ) . outer ( ) . expn_info ( ) . map ( |info| info. call_site . source_callsite ( ) ) . unwrap_or ( self )
292292 }
293293
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+
294300 /// Return the source callee.
295301 ///
296302 /// Returns None if the supplied span has no expansion trace,
You can’t perform that action at this time.
0 commit comments