File tree 1 file changed +10
-9
lines changed
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -453,15 +453,16 @@ pub struct Interner {
453
453
impl Interner {
454
454
fn prefill ( init : & [ & str ] ) -> Self {
455
455
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) ;
465
466
}
466
467
this
467
468
}
You can’t perform that action at this time.
0 commit comments