Description
#102225 attempts to constify Iterator
which would be a stepping stone towards for _ in iter
loops in const fns.
The trouble there is that #[const_trait]
requires that all trait methods are const and Iterator
has an ever-growing set of methods which now all would have to be constified even though we only really need Iterator::next
to be const to enable iterator loops.
And not only do those methods themselves have to be const but their return types must be const-constructable. So this property is quite viral.
Since most of the const trait syntax is still experimental and full of placeholders this may result in an unnecessarily large maintenance burden for the standard library. Additionally it can also hinder future API evolution because it rules out adding impossible-to-constify methods.
From a libs perspective partially const traits would allow us to constify the minimal necessary API surface to unlock further experimentation.
Prior zulip discussion in which the const_trait hackmd was brought up. My reading of it suggests that partially const traits were primarily removed due to open design questions, not due to fundamental impossibility.