File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -463,15 +463,16 @@ pub struct Interner {
463463impl Interner {
464464 fn prefill ( init : & [ & str ] ) -> Self {
465465 let mut this = Interner :: default ( ) ;
466- for & string in init {
467- if string == "" {
468- // We can't allocate empty strings in the arena, so handle this here.
469- let name = Symbol :: new ( this. strings . len ( ) as u32 ) ;
470- this. names . insert ( "" , name) ;
471- this. strings . push ( "" ) ;
472- } else {
473- this. intern ( string) ;
474- }
466+ this. names . reserve ( init. len ( ) ) ;
467+ this. strings . reserve ( init. len ( ) ) ;
468+
469+ // We can't allocate empty strings in the arena, so handle this here.
470+ assert ! ( keywords:: Invalid . name( ) . as_u32( ) == 0 && init[ 0 ] . is_empty( ) ) ;
471+ this. names . insert ( "" , keywords:: Invalid . name ( ) ) ;
472+ this. strings . push ( "" ) ;
473+
474+ for string in & init[ 1 ..] {
475+ this. intern ( string) ;
475476 }
476477 this
477478 }
You can’t perform that action at this time.
0 commit comments