That would be default type parameters, but those don't work with lifetime parameters. Instead, when you elide lifetime parameters on a type constructor, they are inferred:
impl<'a> Struct<'a> {
fn new(i: &i32) -> Struct { // aka Struct<'_> aka matches that of `i`
Struct(i)
}
fn zero(_ignored: &i32) -> Self { // aka Struct<'a>
Struct(&0)
}
}
If Self
was a type constructor, people would very understandably expect it to work like omitted lifetime parameters. But some lifetime default would have to override the inference so that this code continues to work. That alone is probably a blocker for the feature... unless we first get rid of elided lifetimes in paths (so you have to write Struct<'_>
) and then add defaulted life parameters over a series of editions or the like.
Self
is special in other ways that would also need consideration (e.g. is this an expansion of receiver types to anything the Self
type constructor can construct)?