Code change:
Summary from : used as a tuple-struct constructor function should use the fully type-substituted form from the block, but does not. Thus, today this code is accepted, but it should not be. (Fixing this would be a breaking-change, so we should take care in how we deploy it.) Original bug report follows: <!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --I tried this code: In nightly rustc, compiles while yields a type mismatch error:
The one is incorrect, has all its generic parameters substituted, i.e. it's / in both cases, type or constructor function.
To be 100% clear here: I believe what is saying is that the compiler has a bug, and that the bug is that the code should be treated as a short-hand for: and thus should be yielding the same error that one sees for the cases in the code from the description. However, the code is not yielding an error at all.
T-compiler triage: leaving nominated for T-lang. Tagging as P-high priority to resolve whether the semantics described by is indeed what we want, and if so, how to address deploying a breaking-change to fix it.
cc I thought we had fixed this bug in (and to be clear, it's clearly a bug (as noted by in ). It should not compile.
Just to simplify a bit (still passes but shouldn't):
Just checked on godbolt and it seems to compile in every stable release since it was stabilized (). I haven't looked into the code again, but I don't really understand how didn't cover this. Did we forget to add a test with errors, and only tried to prevent ICEs, or something?

Related discussion:
text: <ins> error[E0308]: mismatched types --> $DIR/issue-69306.rs:5:28 | LL | impl<T> S0<T> { |      - this type parameter LL |     const C: S0<u8> = Self(0); |                            ^ expected type parameter `T`, found integer | = note: expected type parameter `T` found type `{integer}` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:5:23 | LL | impl<T> S0<T> { |      - this type parameter LL |     const C: S0<u8> = Self(0); |                       ^^^^^^^ expected `u8`, found type parameter `T` | = note: expected struct `S0<u8>` found struct `S0<T>` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:10:14 | LL | impl<T> S0<T> { |      - this type parameter ... LL |         Self(0); |              ^ expected type parameter `T`, found integer | = note: expected type parameter `T` found type `{integer}` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:27:14 | LL | impl<T> Foo<T> for <S0<T> as Fun>::Out { |      - this type parameter LL |     fn foo() { LL |         Self(0); |              ^ expected type parameter `T`, found integer | = note: expected type parameter `T` found type `{integer}` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:33:32 | LL | impl<T> S1<T, u8> { |      - this type parameter LL |     const C: S1<u8, u8> = Self(0, 1); |                                ^ expected type parameter `T`, found integer | = note: expected type parameter `T` found type `{integer}` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:33:27 | LL | impl<T> S1<T, u8> { |      - this type parameter LL |     const C: S1<u8, u8> = Self(0, 1); |                           ^^^^^^^^^^ expected `u8`, found type parameter `T` | = note: expected struct `S1<u8, _>` found struct `S1<T, _>` = help: type parameters must be constrained to match other types = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:41:14 | LL | impl<T> S2<T> { |      - expected type parameter LL |     fn map<U>(x: U) -> S2<U> { |            - found type parameter LL |         Self(x) |              ^ expected type parameter `T`, found type parameter `U` | = note: expected type parameter `T` found type parameter `U` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:41:9 | LL | impl<T> S2<T> { |      - found type parameter LL |     fn map<U>(x: U) -> S2<U> { |            -           ----- expected `S2<U>` because of return type |            | |            expected type parameter LL |         Self(x) |         ^^^^^^^ expected type parameter `U`, found type parameter `T` | = note: expected struct `S2<U>` found struct `S2<T>` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0308`. </ins>