@@ -14,7 +14,7 @@ use either::Either;
1414use hir_expand:: { hygiene:: Hygiene , name:: AsName , AstId , InFile } ;
1515use itertools:: Itertools ;
1616use la_arena:: ArenaMap ;
17- use mbe:: { syntax_node_to_token_tree, DelimiterKind , MappedSubTree } ;
17+ use mbe:: { syntax_node_to_token_tree, DelimiterKind } ;
1818use smallvec:: { smallvec, SmallVec } ;
1919use syntax:: {
2020 ast:: { self , AstNode , AttrsOwner } ,
@@ -160,18 +160,18 @@ impl RawAttrs {
160160 }
161161
162162 let subtree = match attr. input . as_deref ( ) {
163- Some ( AttrInput :: TokenTree ( it) ) => it,
163+ Some ( AttrInput :: TokenTree ( it, _ ) ) => it,
164164 _ => return smallvec ! [ attr. clone( ) ] ,
165165 } ;
166166
167167 // Input subtree is: `(cfg, $(attr),+)`
168168 // Split it up into a `cfg` subtree and the `attr` subtrees.
169169 // FIXME: There should be a common API for this.
170- let mut parts = subtree. tree . token_trees . split (
170+ let mut parts = subtree. token_trees . split (
171171 |tt| matches ! ( tt, tt:: TokenTree :: Leaf ( tt:: Leaf :: Punct ( p) ) if p. char == ',' ) ,
172172 ) ;
173173 let cfg = parts. next ( ) . unwrap ( ) ;
174- let cfg = Subtree { delimiter : subtree. tree . delimiter , token_trees : cfg. to_vec ( ) } ;
174+ let cfg = Subtree { delimiter : subtree. delimiter , token_trees : cfg. to_vec ( ) } ;
175175 let cfg = CfgExpr :: parse ( & cfg) ;
176176 let index = attr. id ;
177177 let attrs = parts. filter ( |a| !a. is_empty ( ) ) . filter_map ( |attr| {
@@ -260,7 +260,7 @@ impl Attrs {
260260 pub fn docs ( & self ) -> Option < Documentation > {
261261 let docs = self . by_key ( "doc" ) . attrs ( ) . flat_map ( |attr| match attr. input . as_deref ( ) ? {
262262 AttrInput :: Literal ( s) => Some ( s) ,
263- AttrInput :: TokenTree ( _ ) => None ,
263+ AttrInput :: TokenTree ( .. ) => None ,
264264 } ) ;
265265 let indent = docs
266266 . clone ( )
@@ -465,7 +465,7 @@ impl AttrsWithOwner {
465465 // FIXME: code duplication in `docs` above
466466 let docs = self . by_key ( "doc" ) . attrs ( ) . flat_map ( |attr| match attr. input . as_deref ( ) ? {
467467 AttrInput :: Literal ( s) => Some ( ( s, attr. id ) ) ,
468- AttrInput :: TokenTree ( _ ) => None ,
468+ AttrInput :: TokenTree ( .. ) => None ,
469469 } ) ;
470470 let indent = docs
471471 . clone ( )
@@ -654,14 +654,14 @@ pub enum AttrInput {
654654 /// `#[attr = "string"]`
655655 Literal ( SmolStr ) ,
656656 /// `#[attr(subtree)]`
657- TokenTree ( mbe:: MappedSubTree ) ,
657+ TokenTree ( tt :: Subtree , mbe:: TokenMap ) ,
658658}
659659
660660impl fmt:: Display for AttrInput {
661661 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
662662 match self {
663663 AttrInput :: Literal ( lit) => write ! ( f, " = \" {}\" " , lit. escape_debug( ) ) ,
664- AttrInput :: TokenTree ( subtree) => subtree. tree . fmt ( f) ,
664+ AttrInput :: TokenTree ( subtree, _ ) => subtree. fmt ( f) ,
665665 }
666666 }
667667}
@@ -682,7 +682,7 @@ impl Attr {
682682 Some ( Interned :: new ( AttrInput :: Literal ( value) ) )
683683 } else if let Some ( tt) = ast. token_tree ( ) {
684684 let ( tree, map) = syntax_node_to_token_tree ( tt. syntax ( ) ) ;
685- Some ( Interned :: new ( AttrInput :: TokenTree ( MappedSubTree { tree, map } ) ) )
685+ Some ( Interned :: new ( AttrInput :: TokenTree ( tree, map) ) )
686686 } else {
687687 None
688688 } ;
@@ -712,10 +712,9 @@ impl Attr {
712712 }
713713
714714 match self . input . as_deref ( ) {
715- Some ( AttrInput :: TokenTree ( args) ) => {
715+ Some ( AttrInput :: TokenTree ( args, _ ) ) => {
716716 let mut counter = 0 ;
717717 let paths = args
718- . tree
719718 . token_trees
720719 . iter ( )
721720 . group_by ( move |tt| {
@@ -760,7 +759,7 @@ pub struct AttrQuery<'a> {
760759impl < ' a > AttrQuery < ' a > {
761760 pub fn tt_values ( self ) -> impl Iterator < Item = & ' a Subtree > {
762761 self . attrs ( ) . filter_map ( |attr| match attr. input . as_deref ( ) ? {
763- AttrInput :: TokenTree ( it) => Some ( & it . tree ) ,
762+ AttrInput :: TokenTree ( it, _ ) => Some ( it ) ,
764763 _ => None ,
765764 } )
766765 }
0 commit comments