File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -866,20 +866,13 @@ pub struct Interner {
866866}
867867
868868impl 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 ( )
881875 }
882- this
883876 }
884877
885878 pub fn intern ( & mut self , string : & str ) -> Symbol {
You can’t perform that action at this time.
0 commit comments