11//! This module add real world mbe example for benchmark tests
22
33use rustc_hash:: FxHashMap ;
4+ use span:: Span ;
45use syntax:: {
56 ast:: { self , HasName } ,
67 AstNode , SmolStr ,
@@ -9,7 +10,7 @@ use test_utils::{bench, bench_fixture, skip_slow_tests};
910
1011use crate :: {
1112 parser:: { MetaVarKind , Op , RepeatKind , Separator } ,
12- syntax_node_to_token_tree, DeclarativeMacro , DummyTestSpanData , DummyTestSpanMap , DUMMY ,
13+ syntax_node_to_token_tree, DeclarativeMacro , DummyTestSpanMap , DUMMY ,
1314} ;
1415
1516#[ test]
@@ -50,14 +51,14 @@ fn benchmark_expand_macro_rules() {
5051 assert_eq ! ( hash, 69413 ) ;
5152}
5253
53- fn macro_rules_fixtures ( ) -> FxHashMap < String , DeclarativeMacro < DummyTestSpanData > > {
54+ fn macro_rules_fixtures ( ) -> FxHashMap < String , DeclarativeMacro < Span > > {
5455 macro_rules_fixtures_tt ( )
5556 . into_iter ( )
5657 . map ( |( id, tt) | ( id, DeclarativeMacro :: parse_macro_rules ( & tt, true , true ) ) )
5758 . collect ( )
5859}
5960
60- fn macro_rules_fixtures_tt ( ) -> FxHashMap < String , tt:: Subtree < DummyTestSpanData > > {
61+ fn macro_rules_fixtures_tt ( ) -> FxHashMap < String , tt:: Subtree < Span > > {
6162 let fixture = bench_fixture:: numerous_macro_rules ( ) ;
6263 let source_file = ast:: SourceFile :: parse ( & fixture) . ok ( ) . unwrap ( ) ;
6364
@@ -79,8 +80,8 @@ fn macro_rules_fixtures_tt() -> FxHashMap<String, tt::Subtree<DummyTestSpanData>
7980
8081/// Generate random invocation fixtures from rules
8182fn invocation_fixtures (
82- rules : & FxHashMap < String , DeclarativeMacro < DummyTestSpanData > > ,
83- ) -> Vec < ( String , tt:: Subtree < DummyTestSpanData > ) > {
83+ rules : & FxHashMap < String , DeclarativeMacro < Span > > ,
84+ ) -> Vec < ( String , tt:: Subtree < Span > ) > {
8485 let mut seed = 123456789 ;
8586 let mut res = Vec :: new ( ) ;
8687
@@ -128,8 +129,8 @@ fn invocation_fixtures(
128129 return res;
129130
130131 fn collect_from_op (
131- op : & Op < DummyTestSpanData > ,
132- token_trees : & mut Vec < tt:: TokenTree < DummyTestSpanData > > ,
132+ op : & Op < Span > ,
133+ token_trees : & mut Vec < tt:: TokenTree < Span > > ,
133134 seed : & mut usize ,
134135 ) {
135136 return match op {
@@ -221,19 +222,19 @@ fn invocation_fixtures(
221222 * seed = usize:: wrapping_add ( usize:: wrapping_mul ( * seed, a) , c) ;
222223 * seed
223224 }
224- fn make_ident ( ident : & str ) -> tt:: TokenTree < DummyTestSpanData > {
225+ fn make_ident ( ident : & str ) -> tt:: TokenTree < Span > {
225226 tt:: Leaf :: Ident ( tt:: Ident { span : DUMMY , text : SmolStr :: new ( ident) } ) . into ( )
226227 }
227- fn make_punct ( char : char ) -> tt:: TokenTree < DummyTestSpanData > {
228+ fn make_punct ( char : char ) -> tt:: TokenTree < Span > {
228229 tt:: Leaf :: Punct ( tt:: Punct { span : DUMMY , char, spacing : tt:: Spacing :: Alone } ) . into ( )
229230 }
230- fn make_literal ( lit : & str ) -> tt:: TokenTree < DummyTestSpanData > {
231+ fn make_literal ( lit : & str ) -> tt:: TokenTree < Span > {
231232 tt:: Leaf :: Literal ( tt:: Literal { span : DUMMY , text : SmolStr :: new ( lit) } ) . into ( )
232233 }
233234 fn make_subtree (
234235 kind : tt:: DelimiterKind ,
235- token_trees : Option < Vec < tt:: TokenTree < DummyTestSpanData > > > ,
236- ) -> tt:: TokenTree < DummyTestSpanData > {
236+ token_trees : Option < Vec < tt:: TokenTree < Span > > > ,
237+ ) -> tt:: TokenTree < Span > {
237238 tt:: Subtree {
238239 delimiter : tt:: Delimiter { open : DUMMY , close : DUMMY , kind } ,
239240 token_trees : token_trees. map ( Vec :: into_boxed_slice) . unwrap_or_default ( ) ,
0 commit comments