Skip to content

Commit f915b06

Browse files
authored
fix: allow unused lifetimes in tracked_struct expansion (#824)
1 parent 5f149a6 commit f915b06

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

components/salsa-macro-rules/src/setup_tracked_struct.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ macro_rules! setup_tracked_struct {
8787
$Configuration:ident,
8888
$CACHE:ident,
8989
$Db:ident,
90-
$NonNull:ident,
9190
$Revision:ident,
9291
]
9392
) => {
@@ -104,7 +103,6 @@ macro_rules! setup_tracked_struct {
104103
use salsa::plumbing as $zalsa;
105104
use $zalsa::tracked_struct as $zalsa_struct;
106105
use $zalsa::Revision as $Revision;
107-
use std::ptr::NonNull as $NonNull;
108106

109107
type $Configuration = $Struct<'static>;
110108

@@ -207,8 +205,8 @@ macro_rules! setup_tracked_struct {
207205

208206
#[inline]
209207
fn cast(id: $zalsa::Id, type_id: $zalsa::TypeId) -> $zalsa::Option<Self> {
210-
if type_id == $zalsa::TypeId::of::<$Struct>() {
211-
$zalsa::Some(<$Struct as $zalsa::FromId>::from_id(id))
208+
if type_id == $zalsa::TypeId::of::<$Struct<'static>>() {
209+
$zalsa::Some(<$Struct<'static> as $zalsa::FromId>::from_id(id))
212210
} else {
213211
$zalsa::None
214212
}
@@ -289,6 +287,7 @@ macro_rules! setup_tracked_struct {
289287
)*
290288
}
291289

290+
#[allow(unused_lifetimes)]
292291
impl<'_db> $Struct<'_db> {
293292
/// Default debug formatting for this struct (may be useful if you define your own `Debug` impl)
294293
pub fn default_debug_fmt(this: Self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result

components/salsa-macros/src/tracked_struct.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ impl Macro {
119119
let Configuration = self.hygiene.ident("Configuration");
120120
let CACHE = self.hygiene.ident("CACHE");
121121
let Db = self.hygiene.ident("Db");
122-
let NonNull = self.hygiene.ident("NonNull");
123122
let Revision = self.hygiene.ident("Revision");
124123

125124
Ok(crate::debug::dump_tokens(
@@ -160,7 +159,6 @@ impl Macro {
160159
#Configuration,
161160
#CACHE,
162161
#Db,
163-
#NonNull,
164162
#Revision,
165163
]
166164
);

0 commit comments

Comments
 (0)