-
Couldn't load subscription status.
- Fork 13.9k
rustc_resolve: don't deny outer type parameters in embedded constants. #41939
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
Conversation
|
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
a3f677f to
3e32769
Compare
|
The resolve part looks good. |
|
📌 Commit 3e32769 has been approved by |
|
☔ The latest upstream changes (presumably #41965) made this pull request unmergeable. Please resolve the merge conflicts. |
3e32769 to
dc7ffbe
Compare
|
@bors r=petrochenkov |
|
📌 Commit dc7ffbe has been approved by |
…petrochenkov rustc_resolve: don't deny outer type parameters in embedded constants. This solves a problem noted at rust-lang#29646 (comment), where an associated const default in a trait couldn't refer to `Self` or type parameters, due to inaccuracies in lexical scoping. I've also allowed "embedded expressions" (`[T; expr]`, `[x; expr]`, `typeof expr`) to refer to type parameters in scope. *However*, the typesystem still doesn't handle rust-lang#34344. Fully resolving that issue requires breaking cycles more aggressively (e.g. lazy evaluation), *even* in when the expression doesn't depend on type parameters, to type-check it at all, and then also type-level "constant projections" (in the vein of `{expr}` from const generics).
…petrochenkov rustc_resolve: don't deny outer type parameters in embedded constants. This solves a problem noted at rust-lang#29646 (comment), where an associated const default in a trait couldn't refer to `Self` or type parameters, due to inaccuracies in lexical scoping. I've also allowed "embedded expressions" (`[T; expr]`, `[x; expr]`, `typeof expr`) to refer to type parameters in scope. *However*, the typesystem still doesn't handle rust-lang#34344. Fully resolving that issue requires breaking cycles more aggressively (e.g. lazy evaluation), *even* in when the expression doesn't depend on type parameters, to type-check it at all, and then also type-level "constant projections" (in the vein of `{expr}` from const generics).
This solves a problem noted at #29646 (comment), where an associated const default in a trait couldn't refer to
Selfor type parameters, due to inaccuracies in lexical scoping.I've also allowed "embedded expressions" (
[T; expr],[x; expr],typeof expr) to refer to type parameters in scope. However, the typesystem still doesn't handle #34344.Fully resolving that issue requires breaking cycles more aggressively (e.g. lazy evaluation), even in when the expression doesn't depend on type parameters, to type-check it at all, and then also type-level "constant projections" (in the vein of
{expr}from const generics).