Skip to content

internal: Remove the interner/db argument from empty() and default_types() - #23325

Open
ChayimFriedman2 wants to merge 1 commit into
rust-lang:masterfrom
ChayimFriedman2:no-interner-interneds
Open

internal: Remove the interner/db argument from empty() and default_types()#23325
ChayimFriedman2 wants to merge 1 commit into
rust-lang:masterfrom
ChayimFriedman2:no-interner-interneds

Conversation

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Interning doesn't really need an interner since the types are global. Initially I wanted to remove all DbInterner arguments from constructors, however:

  1. This is a much larger change.
  2. We want to eventually move the types under rustc_type_ir. Then having our own constructors will need extension traits and not be comfortable, and the inherent constructors will require an interner (because rustc needs it). However empty lists do not need an interner even in rustc. Pre-interned types (default_types()) do, but this will likely remain under our control, and also the version without interner is a tiny bit more efficient, because the OnceLock closure doesn't have captures.

Essentially implements what I suggested in #23196 (comment), CC @Veykril.

Interning doesn't really need an interner since the types are global. Initially I wanted to remove *all* `DbInterner` arguments from constructors, however:

 1. This is a *much* larger change.
 2. We want to eventually move the types under rustc_type_ir. Then having our own constructors will need extension traits and not be comfortable, and the inherent constructors will require an interner (because rustc needs it). However empty lists do not need an interner even in rustc. Pre-interned types (`default_types()`) do, but this will likely remain under our control, and also the version without interner is a tiny bit more efficient, because the `OnceLock` closure doesn't have captures.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants