Skip to content

const-generics & generic default parameter regression on nightly #74806

Closed
@JulianKnodt

Description

@JulianKnodt

Given that there were many recent changes to const-generics, I don't particularly know if this is an intended change or not. But from the standpoint of an end-user of this feature on nightly, it would appear that something changed that caused downstream things to break without a reference to why. If this was intended, please feel free to close this issue, but I think it might be worthwhile to note what caused this change.

I tried this code:

struct Example<T=f32, const N: usize> {
  item: T,
}

I expected to see this happen: Previously, this would compile on nightly without any error.

Instead, this happened: But this now fails to compile with the error:

error: type parameters with a default must be trailing
... omitted hint ....
note: using type defaults and const parameters in the same parameter list is currently not permitted

If I swap the two items, that is also a compiler error.

Meta

rustc --version --verbose:

rustc 1.47.0-nightly (d6953df14 2020-07-25)
binary: rustc
commit-hash: d6953df14657f5932270ad2b33bccafe6f39fad4
commit-date: 2020-07-25
host: x86_64-apple-darwin
release: 1.47.0-nightly
LLVM version: 10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions