-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With a generic struct, Self(x)
works where x
is of the wrong type argument
#61882
Comments
Yes, that's a bug, We missed a test for this in #53751 somehow (for |
Self constructors were stabilized not too long ago, so this should preferably be fixed soon and backported to beta. |
Ouch, this explains why we were able to remove the struct A<T>(T);
impl A<bool> {
const B: A<u8> = Self::<u8>(0);
} So the order here is wrong: rust/src/librustc_typeck/check/mod.rs Lines 5368 to 5377 in 374c63e
In that Res::SelfCtor really needs to be treated like Res::Local .
|
We shouldn't forget tests like |
…nkov rustc_typeck: correctly compute `Substs` for `Res::SelfCtor`. Fixes rust-lang#61882. r? @petrochenkov cc @varkor
…nkov rustc_typeck: correctly compute `Substs` for `Res::SelfCtor`. Fixes rust-lang#61882. r? @petrochenkov cc @varkor
In particular, we can write:
This can lead to the following interesting situation:
cc @petrochenkov, @varkor, @eddyb, and @alexreg
This does seem like a bug to me... In particular,
type_alias_enum_variants
does not allowSelf::Some(transform(x))
whereSelf == Option<T>
but whereOption<U>
is expected.cc @rust-lang/lang
The text was updated successfully, but these errors were encountered: