Skip to content

Conversation

@smmalis37
Copy link
Contributor

@smmalis37 smmalis37 commented Oct 24, 2025

As per the request on #20896, I removed no_lifetime and added a 'db to InternedOpaqueTyId. This propagated way farther than I expected, but I followed them all. The macro tweaks were the annoying part, as I had to work around the differences between declaring a type in a signature and calling a method on the type. But it all seems to work.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 24, 2025
Ctor
for SolverDefId
);
impl<'db> From<AdtId> for SolverDefId<'db> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impl_from! doesn't work with generics unfortunately.

let method = quote! {
#sig {
#wrapper_struct::new(self, #interned_pat)
#type_constructor new(self, #interned_pat)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, when given the type InternedOpaqueTyId<'db> this would generate InternedOpaqueTyId<'db>::new, which is invalid syntax. Now it removes all the generics, leaving them to be inferred, producing just InternedOpaqueTyId::new. The same applies below.


self.signature = parse_quote!(
fn #ident(&self, id: #interned_key) -> #interned_return_ty
fn #ident #generics(#receiver, id: #interned_key) -> #interned_return_ty
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This &self needs the lifetime now too, hence this change.

@ChayimFriedman2
Copy link
Contributor

I know I've asked for this, but after seeing the diff I'm not sure I prefer that 😅

rustc_type_ir::solve::ExternalConstraintsData<DbInterner<'db>>;

interned_vec_nolifetime_salsa!(SolverDefIds, SolverDefId);
interned_vec_nolifetime_salsa!(SolverDefIds, SolverDefId<'db>);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need more lifetime propagation too? The macro is named nolifetime but it seems to work fine despite the lifetime...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess other uses of this macro already had lifetimes

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.

3 participants