File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -648,6 +648,10 @@ pub(crate) mod parsing {
648
648
pub ( crate ) mod printing {
649
649
use super :: * ;
650
650
use crate :: print:: TokensOrDefault ;
651
+ #[ cfg( feature = "parsing" ) ]
652
+ use crate :: spanned:: Spanned ;
653
+ #[ cfg( feature = "parsing" ) ]
654
+ use proc_macro2:: Span ;
651
655
use proc_macro2:: TokenStream ;
652
656
use quote:: ToTokens ;
653
657
use std:: cmp;
@@ -836,4 +840,21 @@ pub(crate) mod printing {
836
840
segment. to_tokens ( tokens) ;
837
841
}
838
842
}
843
+
844
+ #[ cfg( feature = "parsing" ) ]
845
+ #[ cfg_attr( doc_cfg, doc( cfg( all( feature = "parsing" , feature = "printing" ) ) ) ) ]
846
+ impl Spanned for QSelf {
847
+ fn span ( & self ) -> Span {
848
+ struct QSelfDelimiters < ' a > ( & ' a QSelf ) ;
849
+
850
+ impl < ' a > ToTokens for QSelfDelimiters < ' a > {
851
+ fn to_tokens ( & self , tokens : & mut TokenStream ) {
852
+ self . 0 . lt_token . to_tokens ( tokens) ;
853
+ self . 0 . gt_token . to_tokens ( tokens) ;
854
+ }
855
+ }
856
+
857
+ QSelfDelimiters ( self ) . span ( )
858
+ }
859
+ }
839
860
}
Original file line number Diff line number Diff line change @@ -112,4 +112,7 @@ mod private {
112
112
113
113
pub trait Sealed { }
114
114
impl < T : ?Sized + ToTokens > Sealed for T { }
115
+
116
+ #[ cfg( any( feature = "full" , feature = "derive" ) ) ]
117
+ impl Sealed for crate :: QSelf { }
115
118
}
You can’t perform that action at this time.
0 commit comments