struct NeedsLifetime {
p: *mut u8,
}
type Alias = NeedsLifetime;
After rewriting:
struct NeedsLifetime<'h1> {
p: &'h1 (u8),
}
type Alias = NeedsLifetime;
This output is invalid because the RHS of type Alias uses NeedsLifetime without passing a lifetime argument.
I'm not sure what's the best fix for this. One idea is to add hypothetical params to Alias corresponding to the hypothetical params of all the structs that appear in the RHS. But anywhere types are rewritten, Alias will get unfolded by rewrite::ty due to the mismatch between the HIR Ty and the ty::Ty (the HIR resolves to Alias, but the ty::Ty refers to NeedsLifetime directly), so the only remaining uses of Alias should be in non-rewritten functions. So maybe we should just fill in 'static for all the hypothetical arguments on the RHS, since the use in non-rewritten code will be unsafe regardless.
After rewriting:
This output is invalid because the RHS of
type Alias
usesNeedsLifetime
without passing a lifetime argument.I'm not sure what's the best fix for this. One idea is to add hypothetical params to
Alias
corresponding to the hypothetical params of all the structs that appear in the RHS. But anywhere types are rewritten,Alias
will get unfolded byrewrite::ty
due to the mismatch between the HIRTy
and thety::Ty
(the HIR resolves toAlias
, but thety::Ty
refers toNeedsLifetime
directly), so the only remaining uses ofAlias
should be in non-rewritten functions. So maybe we should just fill in'static
for all the hypothetical arguments on the RHS, since the use in non-rewritten code will be unsafe regardless.