Is interning as a general primitive something that should be in the standard library?

Andyou007:

Every system that accepts input from humans operates on two concepts that are currently absent from core:

  1. A way to store and retrieve values by a stable integer identity (1-based ordinal, where 0 is the null sentinel — the only meaningful null for a computer)
  2. A way to recognize that two inputs are the same value — interning

slice and Vec are memory…

Read more →
Pre-RFC: `pub(api)` visibility, and static enforcement of crate-internal API boundaries

It shouldn't block pub(api) because, as mentioned, it would become a weak keyword. The set of possible first tokens in a pub(E) context I believe are self, super, and in otherwise. If that is the case, then introducing api as another should not be ambiguous.

While pub can be used within a module, the rustc lints documentation suggests that the only reason this isn't a default…

Read more →
Could borrow checking with origins unblock sound specialization

bjorn3:

Because it would require needlessly duplicating functions for every instantiation

No, it wouldn't. Under refined proposal (dropping same origin dispatch), the solver makes the specialization decision before lifetime erasure and bakes it into MIR as a direct function call. Codegen never looks at lifetimes to decide anything.

No function body is ever duplicated based on lifetimes. If a…

Read more →
Could borrow checking with origins unblock sound specialization

bjorn3:

Because it would require needlessly duplicating functions for every instantiation

No, it wouldn't. Under refined proposal (dropping same origin dispatch), the solver makes the specialization decision before lifetime erasure and bakes it into MIR as a direct function call. Codegen never looks at lifetimes to decide anything.

No function body is ever duplicated based on lifetimes. If a…

Read more →
Could borrow checking with origins unblock sound specialization

bjorn3:

Because it would require needlessly duplicating functions for every instantiation

No, it wouldn't. Under refined proposal (dropping same origin dispatch), the solver makes the specialization decision before lifetime erasure and bakes it into MIR as a direct function call. Codegen never looks at lifetimes to decide anything.

No function body is ever duplicated based on lifetimes. If a…

Read more →
Could borrow checking with origins unblock sound specialization

bjorn3:

Because it would require needlessly duplicating functions for every instantiation

No, it wouldn't. Under refined proposal (dropping same origin dispatch), the solver makes the specialization decision before lifetime erasure and bakes it into MIR as a direct function call. Codegen never looks at lifetimes to decide anything.

No function body is ever duplicated based on lifetimes. If a…

Read more →
Idea / Pre-RFC: Null-free pointers

I'd like to take a moment to reflect on the discussion so far. The OP went through multiple revisions in response to the feedback here, and I owe the thread a clearer account of what I've heard, what I've accepted, and what remains open.

What I got wrong

First things first - I owe an apology. The tone of initial draft was too assertive for what should have been an open question. Moreover,…

Read more →
Page 1