Skip to content

Forbid generic parameters in anon consts inside of type defaults #74487

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Jul 27, 2020

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Jul 18, 2020

Emit a resolution error for struct Foo<T, U = [u8; std::mem::size_of::<T>()]>.
We are unable to support this with the way ty::Generics is currently used,
so let's just forbid it entirely for now.

Fixes some ICE on stable, e.g.

struct Foo<T, U = [u8; std::mem::size_of::<*mut T>()]>(T, U);

r? @varkor @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 18, 2020
@lcnr lcnr added A-const-generics Area: const generics (parameters and arguments) F-const_generics `#![feature(const_generics)]` labels Jul 18, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Jul 18, 2020

This finishes the implementation of the required limitation discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/type.20of.20const.20parameters/near/203406561

@varkor
Copy link
Member

varkor commented Jul 27, 2020

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 27, 2020

📌 Commit 5cc40f3c091c9f057571641ca2fa04947409b5cc has been approved by varkor

@bors bors 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 Jul 27, 2020
@bors
Copy link
Collaborator

bors commented Jul 27, 2020

⌛ Testing commit 5cc40f3c091c9f057571641ca2fa04947409b5cc with merge 0d528478bb6829d402606cc81f78d091cb186a32...

@bors
Copy link
Collaborator

bors commented Jul 27, 2020

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 27, 2020
@lcnr lcnr force-pushed the const-in-ty-default branch from 5cc40f3 to 952fd0c Compare July 27, 2020 14:41
@lcnr
Copy link
Contributor Author

lcnr commented Jul 27, 2020

Rebased and updated the affected tests.

@bors r=varkor

@bors
Copy link
Collaborator

bors commented Jul 27, 2020

📌 Commit 952fd0c has been approved by varkor

@bors bors 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 Jul 27, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 27, 2020
…arth

Rollup of 4 pull requests

Successful merges:

 - rust-lang#73858 (Make more primitive integer methods const)
 - rust-lang#74487 (Forbid generic parameters in anon consts inside of type defaults)
 - rust-lang#74803 (rustbuild: fix bad usage of UNIX exec() in rustc wrapper)
 - rust-lang#74822 (More ensure stack to avoid segfault with increased `recursion_limit`)

Failed merges:

r? @ghost
@bors bors merged commit e054340 into rust-lang:master Jul 27, 2020
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-const-generics Area: const generics (parameters and arguments) F-const_generics `#![feature(const_generics)]` 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.

5 participants