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 @@ -453,15 +453,16 @@ pub struct Interner {
453453impl Interner {
454454 fn prefill ( init : & [ & str ] ) -> Self {
455455 let mut this = Interner :: default ( ) ;
456- for & string in init {
457- if string == "" {
458- // We can't allocate empty strings in the arena, so handle this here.
459- let name = Symbol :: new ( this. strings . len ( ) as u32 ) ;
460- this. names . insert ( "" , name) ;
461- this. strings . push ( "" ) ;
462- } else {
463- this. intern ( string) ;
464- }
456+ this. names . reserve ( init. len ( ) ) ;
457+ this. strings . reserve ( init. len ( ) ) ;
458+
459+ // We can't allocate empty strings in the arena, so handle this here.
460+ assert ! ( keywords:: Invalid . name( ) . as_u32( ) == 0 && init[ 0 ] . is_empty( ) ) ;
461+ this. names . insert ( "" , keywords:: Invalid . name ( ) ) ;
462+ this. strings . push ( "" ) ;
463+
464+ for string in & init[ 1 ..] {
465+ this. intern ( string) ;
465466 }
466467 this
467468 }
You can’t perform that action at this time.
0 commit comments