Why Interned is used in rust/src/bootstrap?


I’m wondering why the Interned type is used for string literals under rust/src/bootstrap. Wouldn’t the compiler (stage0?) intern the string literals?



These two interners are completely independent (bootstrap is a small program isolated from the rest of compiler).

The bootstrap interner was added in https://github.com/rust-lang/rust/pull/43059 to avoid unergonomic Rc<String> (https://github.com/rust-lang/rust/pull/43059/files#r127785928).
Regarding why bootstrap uses Rc<String> instead of String in the first place, it’s certainly intended to be an optimization, but I’m not sure if it has any measurable impact or not, @Mark_Simulacrum may know better.

1 Like


It sounds like they just want the ergonomic benefit of avoiding clone(). I don’t think anyone is worried about bootstrap performance, because it’s not even compiled in release mode! :slight_smile:


closed #4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.