-
Notifications
You must be signed in to change notification settings - Fork 175
feature: allow skipping the lifetime on #[salsa::interned]
structs
#661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: allow skipping the lifetime on #[salsa::interned]
structs
#661
Conversation
✅ Deploy Preview for salsa-rs canceled.
|
CodSpeed Performance ReportMerging #661 will not alter performanceComparing Summary
|
231806c
to
8ff97d7
Compare
impl salsa::plumbing::interned::Configuration for $StructWithStatic { | ||
const DEBUG_NAME: &'static str = stringify!($Struct); | ||
type Data<'a> = $StructDataIdent<'a>; | ||
type Struct<'db> = $Struct< $($db_lt_arg)? >; | ||
fn struct_from_id<'db>(id: salsa::Id) -> Self::Struct<'db> { | ||
use salsa::plumbing::FromId; | ||
$Struct(<$Id>::from_id(id), std::marker::PhantomData) | ||
} | ||
fn deref_struct(s: Self::Struct<'_>) -> salsa::Id { | ||
use salsa::plumbing::AsId; | ||
s.0.as_id() | ||
} | ||
} | ||
|
||
type $StructDataIdent<$db_lt> = ($($field_ty,)*); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this got moved up out of the const _
scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it'd be necessary to get completions from rust-analyzer, but it wasn't. reverted.
f7bb8c6
to
bd81aa4
Compare
This PR adds support for three features:
#[salsa::interned(no_lifetime)]
allows skipping the'db
lifetime.#[salsa::interned]
structs now have public ingredients, which allows accessing the underlying, interned data through thesalsa::Id
alone.In my view, the use of the above features should be discouraged, but they are necessary for rust-analyzer to migrate to the new version of Salsa.
This PR supersedes #632.