5
5
use arena:: DroplessArena ;
6
6
use rustc_data_structures:: fx:: FxHashMap ;
7
7
use rustc_data_structures:: indexed_vec:: Idx ;
8
+ use rustc_data_structures:: newtype_index;
8
9
use serialize:: { Decodable , Decoder , Encodable , Encoder } ;
9
10
10
11
use std:: fmt;
11
12
use std:: str;
12
13
use std:: cmp:: { PartialEq , Ordering , PartialOrd , Ord } ;
13
14
use std:: hash:: { Hash , Hasher } ;
14
15
15
- use hygiene:: SyntaxContext ;
16
- use { Span , DUMMY_SP , GLOBALS } ;
16
+ use crate :: hygiene:: SyntaxContext ;
17
+ use crate :: { Span , DUMMY_SP , GLOBALS } ;
17
18
18
19
#[ derive( Copy , Clone , Eq ) ]
19
20
pub struct Ident {
@@ -100,13 +101,13 @@ impl Hash for Ident {
100
101
}
101
102
102
103
impl fmt:: Debug for Ident {
103
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
104
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
104
105
write ! ( f, "{}{:?}" , self . name, self . span. ctxt( ) )
105
106
}
106
107
}
107
108
108
109
impl fmt:: Display for Ident {
109
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
110
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
110
111
fmt:: Display :: fmt ( & self . name , f)
111
112
}
112
113
}
@@ -181,7 +182,7 @@ impl Symbol {
181
182
pub fn as_str ( self ) -> LocalInternedString {
182
183
with_interner ( |interner| unsafe {
183
184
LocalInternedString {
184
- string : :: std:: mem:: transmute :: < & str , & str > ( interner. get ( self ) )
185
+ string : std:: mem:: transmute :: < & str , & str > ( interner. get ( self ) )
185
186
}
186
187
} )
187
188
}
@@ -198,7 +199,7 @@ impl Symbol {
198
199
}
199
200
200
201
impl fmt:: Debug for Symbol {
201
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
202
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
202
203
let is_gensymed = with_interner ( |interner| interner. is_gensymed ( * self ) ) ;
203
204
if is_gensymed {
204
205
write ! ( f, "{}({:?})" , self , self . 0 )
@@ -209,7 +210,7 @@ impl fmt::Debug for Symbol {
209
210
}
210
211
211
212
impl fmt:: Display for Symbol {
212
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
213
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
213
214
fmt:: Display :: fmt ( & self . as_str ( ) , f)
214
215
}
215
216
}
@@ -226,7 +227,7 @@ impl Decodable for Symbol {
226
227
}
227
228
}
228
229
229
- impl < T : :: std:: ops:: Deref < Target =str > > PartialEq < T > for Symbol {
230
+ impl < T : std:: ops:: Deref < Target =str > > PartialEq < T > for Symbol {
230
231
fn eq ( & self , other : & T ) -> bool {
231
232
self . as_str ( ) == other. deref ( )
232
233
}
@@ -335,7 +336,7 @@ macro_rules! declare_keywords {(
335
336
} ;
336
337
) *
337
338
338
- impl :: std:: str :: FromStr for Keyword {
339
+ impl std:: str :: FromStr for Keyword {
339
340
type Err = ( ) ;
340
341
341
342
fn from_str( s: & str ) -> Result <Self , ( ) > {
@@ -519,40 +520,40 @@ impl LocalInternedString {
519
520
}
520
521
}
521
522
522
- impl < U : ?Sized > :: std:: convert:: AsRef < U > for LocalInternedString
523
+ impl < U : ?Sized > std:: convert:: AsRef < U > for LocalInternedString
523
524
where
524
- str : :: std:: convert:: AsRef < U >
525
+ str : std:: convert:: AsRef < U >
525
526
{
526
527
fn as_ref ( & self ) -> & U {
527
528
self . string . as_ref ( )
528
529
}
529
530
}
530
531
531
- impl < T : :: std:: ops:: Deref < Target = str > > :: std:: cmp:: PartialEq < T > for LocalInternedString {
532
+ impl < T : std:: ops:: Deref < Target = str > > std:: cmp:: PartialEq < T > for LocalInternedString {
532
533
fn eq ( & self , other : & T ) -> bool {
533
534
self . string == other. deref ( )
534
535
}
535
536
}
536
537
537
- impl :: std:: cmp:: PartialEq < LocalInternedString > for str {
538
+ impl std:: cmp:: PartialEq < LocalInternedString > for str {
538
539
fn eq ( & self , other : & LocalInternedString ) -> bool {
539
540
self == other. string
540
541
}
541
542
}
542
543
543
- impl < ' a > :: std:: cmp:: PartialEq < LocalInternedString > for & ' a str {
544
+ impl < ' a > std:: cmp:: PartialEq < LocalInternedString > for & ' a str {
544
545
fn eq ( & self , other : & LocalInternedString ) -> bool {
545
546
* self == other. string
546
547
}
547
548
}
548
549
549
- impl :: std:: cmp:: PartialEq < LocalInternedString > for String {
550
+ impl std:: cmp:: PartialEq < LocalInternedString > for String {
550
551
fn eq ( & self , other : & LocalInternedString ) -> bool {
551
552
self == other. string
552
553
}
553
554
}
554
555
555
- impl < ' a > :: std:: cmp:: PartialEq < LocalInternedString > for & ' a String {
556
+ impl < ' a > std:: cmp:: PartialEq < LocalInternedString > for & ' a String {
556
557
fn eq ( & self , other : & LocalInternedString ) -> bool {
557
558
* self == other. string
558
559
}
@@ -561,19 +562,19 @@ impl<'a> ::std::cmp::PartialEq<LocalInternedString> for &'a String {
561
562
impl !Send for LocalInternedString { }
562
563
impl !Sync for LocalInternedString { }
563
564
564
- impl :: std:: ops:: Deref for LocalInternedString {
565
+ impl std:: ops:: Deref for LocalInternedString {
565
566
type Target = str ;
566
567
fn deref ( & self ) -> & str { self . string }
567
568
}
568
569
569
570
impl fmt:: Debug for LocalInternedString {
570
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
571
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
571
572
fmt:: Debug :: fmt ( self . string , f)
572
573
}
573
574
}
574
575
575
576
impl fmt:: Display for LocalInternedString {
576
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
577
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
577
578
fmt:: Display :: fmt ( self . string , f)
578
579
}
579
580
}
@@ -640,7 +641,7 @@ impl Ord for InternedString {
640
641
}
641
642
}
642
643
643
- impl < T : :: std:: ops:: Deref < Target = str > > PartialEq < T > for InternedString {
644
+ impl < T : std:: ops:: Deref < Target = str > > PartialEq < T > for InternedString {
644
645
fn eq ( & self , other : & T ) -> bool {
645
646
self . with ( |string| string == other. deref ( ) )
646
647
}
@@ -676,20 +677,20 @@ impl<'a> PartialEq<InternedString> for &'a String {
676
677
}
677
678
}
678
679
679
- impl :: std:: convert:: From < InternedString > for String {
680
+ impl std:: convert:: From < InternedString > for String {
680
681
fn from ( val : InternedString ) -> String {
681
682
val. as_symbol ( ) . to_string ( )
682
683
}
683
684
}
684
685
685
686
impl fmt:: Debug for InternedString {
686
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
687
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
687
688
self . with ( |str| fmt:: Debug :: fmt ( & str, f) )
688
689
}
689
690
}
690
691
691
692
impl fmt:: Display for InternedString {
692
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
693
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
693
694
self . with ( |str| fmt:: Display :: fmt ( & str, f) )
694
695
}
695
696
}
@@ -709,7 +710,7 @@ impl Encodable for InternedString {
709
710
#[ cfg( test) ]
710
711
mod tests {
711
712
use super :: * ;
712
- use Globals ;
713
+ use crate :: Globals ;
713
714
714
715
#[ test]
715
716
fn interner_tests ( ) {
0 commit comments