@@ -40,7 +40,7 @@ use rustc_metadata::cstore::CStore;
40
40
use syntax:: ext:: hygiene:: { ExpnId , Transparency , SyntaxContext } ;
41
41
use syntax:: ast:: { self , Name , NodeId , Ident , FloatTy , IntTy , UintTy } ;
42
42
use syntax:: ext:: base:: { SyntaxExtension , MacroKind , SpecialDerives } ;
43
- use syntax:: symbol:: { Symbol , kw, sym} ;
43
+ use syntax:: symbol:: { kw, sym} ;
44
44
45
45
use syntax:: visit:: { self , Visitor } ;
46
46
use syntax:: attr;
@@ -241,7 +241,7 @@ impl Segment {
241
241
242
242
fn names_to_string ( segments : & [ Segment ] ) -> String {
243
243
names_to_string ( & segments. iter ( )
244
- . map ( |seg| seg. ident )
244
+ . map ( |seg| seg. ident . name )
245
245
. collect :: < Vec < _ > > ( ) )
246
246
}
247
247
}
@@ -951,7 +951,7 @@ pub struct Resolver<'a> {
951
951
struct_constructors : DefIdMap < ( Res , ty:: Visibility ) > ,
952
952
953
953
/// Features enabled for this crate.
954
- active_features : FxHashSet < Symbol > ,
954
+ active_features : FxHashSet < Name > ,
955
955
956
956
/// Stores enum visibilities to properly build a reduced graph
957
957
/// when visiting the correspondent variants.
@@ -1018,8 +1018,8 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
1018
1018
fn resolve_str_path (
1019
1019
& mut self ,
1020
1020
span : Span ,
1021
- crate_root : Option < Symbol > ,
1022
- components : & [ Symbol ] ,
1021
+ crate_root : Option < Name > ,
1022
+ components : & [ Name ] ,
1023
1023
ns : Namespace ,
1024
1024
) -> ( ast:: Path , Res ) {
1025
1025
let root = if crate_root. is_some ( ) {
@@ -2555,7 +2555,7 @@ impl<'a> Resolver<'a> {
2555
2555
fn add_suggestion_for_rename_of_use (
2556
2556
& self ,
2557
2557
err : & mut DiagnosticBuilder < ' _ > ,
2558
- name : Symbol ,
2558
+ name : Name ,
2559
2559
directive : & ImportDirective < ' _ > ,
2560
2560
binding_span : Span ,
2561
2561
) {
@@ -2770,38 +2770,37 @@ impl<'a> Resolver<'a> {
2770
2770
}
2771
2771
}
2772
2772
2773
- fn names_to_string ( idents : & [ Ident ] ) -> String {
2773
+ fn names_to_string ( names : & [ Name ] ) -> String {
2774
2774
let mut result = String :: new ( ) ;
2775
- for ( i, ident ) in idents . iter ( )
2776
- . filter ( |ident| ident . name != kw:: PathRoot )
2775
+ for ( i, name ) in names . iter ( )
2776
+ . filter ( |name| * * name != kw:: PathRoot )
2777
2777
. enumerate ( ) {
2778
2778
if i > 0 {
2779
2779
result. push_str ( "::" ) ;
2780
2780
}
2781
- result. push_str ( & ident . as_str ( ) ) ;
2781
+ result. push_str ( & name . as_str ( ) ) ;
2782
2782
}
2783
2783
result
2784
2784
}
2785
2785
2786
2786
fn path_names_to_string ( path : & Path ) -> String {
2787
2787
names_to_string ( & path. segments . iter ( )
2788
- . map ( |seg| seg. ident )
2788
+ . map ( |seg| seg. ident . name )
2789
2789
. collect :: < Vec < _ > > ( ) )
2790
2790
}
2791
2791
2792
2792
/// A somewhat inefficient routine to obtain the name of a module.
2793
2793
fn module_to_string ( module : Module < ' _ > ) -> Option < String > {
2794
2794
let mut names = Vec :: new ( ) ;
2795
2795
2796
- fn collect_mod ( names : & mut Vec < Ident > , module : Module < ' _ > ) {
2796
+ fn collect_mod ( names : & mut Vec < Name > , module : Module < ' _ > ) {
2797
2797
if let ModuleKind :: Def ( .., name) = module. kind {
2798
2798
if let Some ( parent) = module. parent {
2799
- names. push ( Ident :: with_dummy_span ( name) ) ;
2799
+ names. push ( name) ;
2800
2800
collect_mod ( names, parent) ;
2801
2801
}
2802
2802
} else {
2803
- // danger, shouldn't be ident?
2804
- names. push ( Ident :: from_str ( "<opaque>" ) ) ;
2803
+ names. push ( Name :: intern ( "<opaque>" ) ) ;
2805
2804
collect_mod ( names, module. parent . unwrap ( ) ) ;
2806
2805
}
2807
2806
}
@@ -2810,9 +2809,8 @@ fn module_to_string(module: Module<'_>) -> Option<String> {
2810
2809
if names. is_empty ( ) {
2811
2810
return None ;
2812
2811
}
2813
- Some ( names_to_string ( & names. into_iter ( )
2814
- . rev ( )
2815
- . collect :: < Vec < _ > > ( ) ) )
2812
+ names. reverse ( ) ;
2813
+ Some ( names_to_string ( & names) )
2816
2814
}
2817
2815
2818
2816
#[ derive( Copy , Clone , Debug ) ]
0 commit comments