Skip to content

array repeat exprs do not check the array type is well formed #111091

Closed

Description

I tried this code:

trait Foo {
    const ASSOC: [u8];
}

fn bar<T: Foo>() {
    let a = [T::ASSOC; 2];
}

fn main() {}

I expected to see this happen: It should not compile as the local variable a has type [[u8]; 2] which is not well formed

Instead, this happened: it compiled 😬

Meta

playground version:

Nightly channel

Build using the Nightly version: 1.71.0-nightly

(2023-04-30 9ecda8de85ce893cc3fc)
Backtrace

<backtrace>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-typesRelevant to the types team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions