Skip to content

Using associated constants for generics is not considered using a type generic #80977

Closed

Description

@clarfonthey

Filing in addition to #80976 because this seems to be a separate issue. Includes the same example below. Essentially, even though the associated constant To::DIM is being used in the definition of the struct, the compiler marks To as being unused since no types related to it are being used.

#![feature(const_generics, const_evaluatable_checked)]

trait Vector {
    type Scalar;
    const DIM: usize;
}

struct Transform<From, To>
where
    From: Vector,
    To: Vector<Scalar = From::Scalar>,
{
    columns: [[From::Scalar; From::DIM]; To::DIM],
}

(Playground)

Activity

  1. added 2 commits that reference this issue on Oct 23, 2021
    809e5c8
    2b874f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions