You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a duplicate of several previously closed issues.
type Bar = Foo; is a type alias, it defines a name only in type namespace and doesn't know anything about the constructor function associated with Foo.
I don't think type can be changed to introduce names into value namespace now, so this issue is unlikely to be fixed as is (#42601 is a bit different because Self is reserved and currently unused in value namespace, so we can make it resolve to the constructor function when used in value context).
If we had fn aliases in addition to type aliases you could write something like fn Bar = Foo; to alias the constructor. For now fn Bar(arg: u32) -> Bar { Foo(arg) } can be used (possibly combined with type Bar = Foo; into a convenience macro).
The following code fails to compile, but it seems correct to me:
One alternative is
use Foo as Bar;
, but that doesn't allow me to give a different doc comment forBar
.#42601 is a closely related issue (or even the same).
Meta
rustc 1.18.0 (03fc9d6 2017-06-06)
binary: rustc
commit-hash: 03fc9d6
commit-date: 2017-06-06
host: x86_64-unknown-linux-gnu
release: 1.18.0
LLVM version: 3.9
The text was updated successfully, but these errors were encountered: