Skip to content

forbid generic params in the type of const params - #74159

Merged
bors merged 8 commits into
rust-lang:masterfrom
lcnr:const-generic-ty-decl
Jul 16, 2020
Merged

forbid generic params in the type of const params#74159
bors merged 8 commits into
rust-lang:masterfrom
lcnr:const-generic-ty-decl

Conversation

@lcnr

@lcnrlcnr commented Jul 8, 2020

Copy link
Copy Markdown
Contributor

implements and closes#74152

fixes#74101, closes#71169, fixes#73491, closes#62878

@eddyb and I talked on zulip about this and we probably want to also forbid generic consts in the default
type of a parameter, e.g. struct Foo<T, U = [u8; std::mem::size_of::<T>()]>, this is currently still allowed
and I will probably fix that in a followup PR.

r? @varkor@eddyb

@rust-highfive

Copy link
Copy Markdown
Contributor

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 8, 2020
@lcnrlcnr added F-const_generics `#![feature(const_generics)]` A-const-generics Area: const generics (parameters and arguments) labels Jul 8, 2020
@lcnr
lcnrforce-pushed the const-generic-ty-decl branch 2 times, most recently from 5dc2fe6 to bf9142aCompareJuly 9, 2020 20:28
@varkor

Copy link
Copy Markdown
Contributor

I think it'd help to discuss this on Zulip, because there were objections previously to blocking this in name resolution. I also want to figure out where the previous error went missing, because I would have thought it would have been sufficient if it had stayed around. I'll try to look, but I don't have time immediately.

@bors

bors commented Jul 14, 2020

Copy link
Copy Markdown
Collaborator

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

Comment threadsrc/test/ui/const-generics/const-param-type-depends-on-const-param.stderr Outdated
@varkor

Copy link
Copy Markdown
Contributor

I'm happy with the implementation: I just want to tweak that error message a little bit.

@lcnr
lcnrforce-pushed the const-generic-ty-decl branch from bf9142a to 072287dCompareJuly 16, 2020 09:00
@lcnr
lcnrforce-pushed the const-generic-ty-decl branch from ac504c2 to 0c511abCompareJuly 16, 2020 09:13
@varkor

Copy link
Copy Markdown
Contributor

@bors r+

Thanks!

@bors

bors commented Jul 16, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 09ba0bd has been approved by varkor

@borsbors 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 16, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 16, 2020
forbid generic params in the type of const params
implements and closesrust-lang#74152fixesrust-lang#74101, closesrust-lang#71169, fixesrust-lang#73491, closesrust-lang#62878@eddyb and I talked [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/type.20of.20const.20parameters/near/203405696) about this and we probably want to also forbid generic consts in the default
type of a parameter, e.g. `struct Foo<T, U = [u8; std::mem::size_of::<T>()]>`, this is currently still allowed
and I will probably fix that in a followup PR.
r? @varkor@eddyb
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 16, 2020
forbid generic params in the type of const params
implements and closesrust-lang#74152fixesrust-lang#74101, closesrust-lang#71169, fixesrust-lang#73491, closesrust-lang#62878@eddyb and I talked [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/type.20of.20const.20parameters/near/203405696) about this and we probably want to also forbid generic consts in the default
type of a parameter, e.g. `struct Foo<T, U = [u8; std::mem::size_of::<T>()]>`, this is currently still allowed
and I will probably fix that in a followup PR.
r? @varkor@eddyb
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 16, 2020
…arth
Rollup of 21 pull requests
Successful merges:
- rust-lang#73566 (Don't run `everybody_loops` for rustdoc; instead ignore resolution errors)
- rust-lang#73771 (Don't pollute docs/suggestions with libstd deps)
- rust-lang#73794 (Small cleanup for E0705 explanation)
- rust-lang#73807 (rustdoc: glue tokens before highlighting)
- rust-lang#73835 (Clean up E0710 explanation)
- rust-lang#73926 (Ignoring test case: [codegen] repr-transparent-aggregates-1.rs for aarch64)
- rust-lang#73981 (Remove some `ignore-stage1` annotations.)
- rust-lang#73998 (add regression test for rust-lang#61216)
- rust-lang#74140 (Make hir ProjectionKind more precise)
- rust-lang#74148 (Move #[doc(alias)] check in rustc)
- rust-lang#74159 (forbid generic params in the type of const params)
- rust-lang#74171 (Fix 44056 test with debug on macos.)
- rust-lang#74221 (Don't panic if the lhs of a div by zero is not statically known)
- rust-lang#74325 (Focus on the current file in the source file sidebar)
- rust-lang#74359 (rustdoc: Rename internal API fns to `into_string`)
- rust-lang#74370 (Reintroduce spotlight / "important traits" feature)
- rust-lang#74390 (Fix typo in std::mem::transmute documentation)
- rust-lang#74391 (BtreeMap: superficially refactor root access)
- rust-lang#74392 (const generics triage)
- rust-lang#74397 (Fix typo in the latest release note)
- rust-lang#74406 (Set shell for github actions CI)
Failed merges:
r? @ghost
@bors
bors merged commit 6ef0dfa into rust-lang:masterJul 16, 2020
@lcnr
lcnr deleted the const-generic-ty-decl branch July 17, 2020 06:08
Manishearth pushed a commit to Manishearth/rust that referenced this pull request Jul 18, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 18, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 18, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 18, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 18, 2020
@cuvipercuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-const-genericsArea: const generics (parameters and arguments)F-const_generics`#![feature(const_generics)]`S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

5 participants

@lcnr@rust-highfive@varkor@bors@cuviper