1
Fork 0

Remove in_band_lifetimes from rustc_middle

See #91867

This was mostly straightforward. In several places, I take advantage
of the fact that lifetimes are non-hygenic: a macro declares the
'tcx' lifetime, which is then used in types passed in as macro
arguments.
This commit is contained in:
Aaron Hill 2021-12-15 19:32:30 -05:00
parent c5ecc15704
commit 070bf94a6f
No known key found for this signature in database
GPG key ID: B4087E510E98B164
42 changed files with 116 additions and 111 deletions

View file

@ -1,10 +1,15 @@
use quote::quote;
use syn::parse_quote;
pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
if let syn::Data::Union(_) = s.ast().data {
panic!("cannot derive on union")
}
if !s.ast().generics.lifetimes().any(|lt| lt.lifetime.ident == "tcx") {
s.add_impl_generic(parse_quote! { 'tcx });
}
s.add_bounds(synstructure::AddBounds::Generics);
let body_visit = s.each(|bind| {
quote! {