Move the generic type from the trait Into signature to the into method

Type parameters on functions can't have defaults at present.

I know, that's why I asked whether the language could be changed to allow this, with my proposed semantics.

It's future-compatibility linted, but they can (however the have the same problems as other default parameters with less workarounds due to unnameable types).

I'm not on any teams, but I'd be surprised if inference-effecting type defaults (default type parameter fallback) gets restarted without a much deeper dive (and is hopefully consistent with the default parameters that are stable and not deny-by-default).

Just to clarify - I think this is different from default type parameters, because if we used

Then implementing e.g. Into<i32> would require implementing fn into<T2>(self) -> T2 for all T2, not just i32. (Unless I'm misunderstanding how default type parameters work on functions)

1 Like

I'm absolutely not saying that it's a reasonable thing to do, but we theoretically could create a new Into trait which places the (From-bound) generic on the method instead of the trait and then switch out the old Into trait for the new Into trait in the prelude over an edition.

That std::convert::Into (and TryInto) remain with the current signature is reason not to do this switcheroo in this way.