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 @@ -909,20 +909,13 @@ pub struct Interner {
909909}
910910
911911impl Interner {
912- fn prefill ( init : & [ & str ] ) -> Self {
913- let mut this = Interner :: default ( ) ;
914- this. names . reserve ( init. len ( ) ) ;
915- this. strings . reserve ( init. len ( ) ) ;
916-
917- // We can't allocate empty strings in the arena, so handle this here.
918- assert ! ( kw:: Invalid . as_u32( ) == 0 && init[ 0 ] . is_empty( ) ) ;
919- this. names . insert ( "" , kw:: Invalid ) ;
920- this. strings . push ( "" ) ;
921-
922- for string in & init[ 1 ..] {
923- this. intern ( string) ;
912+ fn prefill ( init : & [ & ' static str ] ) -> Self {
913+ let symbols = ( 0 .. init. len ( ) as u32 ) . map ( Symbol :: new) ;
914+ Interner {
915+ strings : init. to_vec ( ) ,
916+ names : init. iter ( ) . copied ( ) . zip ( symbols) . collect ( ) ,
917+ ..Default :: default ( )
924918 }
925- this
926919 }
927920
928921 pub fn intern ( & mut self , string : & str ) -> Symbol {
You can’t perform that action at this time.
0 commit comments