Skip to content
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

rustc_resolve: don't deny outer type parameters in embedded constants. #41939

Merged
merged 1 commit into from
May 14, 2017

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented May 12, 2017

This solves a problem noted at #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 #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).

@rust-highfive
Copy link
Collaborator

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@eddyb
Copy link
Member Author

eddyb commented May 12, 2017

cc @nikomatsakis @withoutboats

@eddyb eddyb force-pushed the trait-assoc-const-default branch from a3f677f to 3e32769 Compare May 12, 2017 13:42
@shepmaster shepmaster added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 12, 2017
@petrochenkov
Copy link
Contributor

The resolve part looks good.
@bors r+

@bors
Copy link
Contributor

bors commented May 13, 2017

📌 Commit 3e32769 has been approved by petrochenkov

@eddyb eddyb added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 13, 2017
@bors
Copy link
Contributor

bors commented May 13, 2017

☔ The latest upstream changes (presumably #41965) made this pull request unmergeable. Please resolve the merge conflicts.

@eddyb eddyb force-pushed the trait-assoc-const-default branch from 3e32769 to dc7ffbe Compare May 13, 2017 14:46
@eddyb
Copy link
Member Author

eddyb commented May 13, 2017

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented May 13, 2017

📌 Commit dc7ffbe has been approved by petrochenkov

bors added a commit that referenced this pull request May 13, 2017
Rollup of 5 pull requests

- Successful merges: #41826, #41919, #41946, #41967, #41969
- Failed merges: #41939
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 13, 2017
…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).
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 14, 2017
…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).
bors added a commit that referenced this pull request May 14, 2017
Rollup of 7 pull requests

- Successful merges: #41612, #41826, #41939, #41946, #41950, #41975, #41979
- Failed merges:
@bors bors merged commit dc7ffbe into rust-lang:master May 14, 2017
@eddyb eddyb deleted the trait-assoc-const-default branch May 14, 2017 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants