File tree 1 file changed +6
-13
lines changed
1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -866,20 +866,13 @@ pub struct Interner {
866
866
}
867
867
868
868
impl Interner {
869
- fn prefill ( init : & [ & str ] ) -> Self {
870
- let mut this = Interner :: default ( ) ;
871
- this. names . reserve ( init. len ( ) ) ;
872
- this. strings . reserve ( init. len ( ) ) ;
873
-
874
- // We can't allocate empty strings in the arena, so handle this here.
875
- assert ! ( kw:: Invalid . as_u32( ) == 0 && init[ 0 ] . is_empty( ) ) ;
876
- this. names . insert ( "" , kw:: Invalid ) ;
877
- this. strings . push ( "" ) ;
878
-
879
- for string in & init[ 1 ..] {
880
- this. intern ( string) ;
869
+ fn prefill ( init : & [ & ' static str ] ) -> Self {
870
+ let symbols = ( 0 .. init. len ( ) as u32 ) . map ( Symbol :: new) ;
871
+ Interner {
872
+ strings : init. to_vec ( ) ,
873
+ names : init. iter ( ) . copied ( ) . zip ( symbols) . collect ( ) ,
874
+ ..Default :: default ( )
881
875
}
882
- this
883
876
}
884
877
885
878
pub fn intern ( & mut self , string : & str ) -> Symbol {
You can’t perform that action at this time.
0 commit comments