Omitting return type of trait method to use () doesn't work with associated_type_defaults when default is () #54182
Labels
A-associated-items
Area: Associated items (types, constants & functions)
C-bug
Category: This is a bug.
F-associated_type_defaults
`#![feature(associated_type_defaults)]`
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Omitting the return type of a trait method to use
()
doesn't work withassociated_type_defaults
when the default is()
(type R = ();
):https://play.rust-lang.org/?gist=2b56fc463679d93f1c24a8af3495c776&version=nightly&mode=debug&edition=2015
Even when I uncomment both occurrences of
/*-> Self::R*/
, it doesn't work:I also have to uncomment both occurrences of
// type R = ();
to get it to compile.Which defeats the purpose of using
associated_type_defaults
here :/I think this should work as intended though.
And when the default type is not
()
(e.g.type R = i32;
), it should still work to only writefn overload(self) -> Self::R {
without overridingtype R
in thisimpl
(if one wants to use the defaultR
here).The text was updated successfully, but these errors were encountered: