-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add a lot more db lifetimes #20897
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
base: master
Are you sure you want to change the base?
Add a lot more db lifetimes #20897
Conversation
| Ctor | ||
| for SolverDefId | ||
| ); | ||
| impl<'db> From<AdtId> for SolverDefId<'db> { |
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.
impl_from! doesn't work with generics unfortunately.
| let method = quote! { | ||
| #sig { | ||
| #wrapper_struct::new(self, #interned_pat) | ||
| #type_constructor new(self, #interned_pat) |
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.
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 |
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.
This &self needs the lifetime now too, hence this change.
|
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>); |
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.
Does this need more lifetime propagation too? The macro is named nolifetime but it seems to work fine despite the lifetime...
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 guess other uses of this macro already had lifetimes
As per the request on #20896, I removed
no_lifetimeand 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.