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 @@ -463,15 +463,16 @@ pub struct Interner {
463
463
impl Interner {
464
464
fn prefill ( init : & [ & str ] ) -> Self {
465
465
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) ;
475
476
}
476
477
this
477
478
}
You can’t perform that action at this time.
0 commit comments