Skip to content

&Box<[T; N]> doesn't impl IntoIterator #155577

@programmerjake

Description

@programmerjake

I tried this code:

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=04a2170785a4ddc68cf07d0757f41fb3

pub fn f(v: &Box<[String; 10]>) {
    for i in v {
        println("{i:?}");
    }
}

I expected to see this happen: compiles successfully and iterates over the boxed array.

Instead, this happened:

error[E0277]: `&Box<[String; 10]>` is not an iterator

Meta

rustc --version --verbose: (from playground)

1.97.0-nightly (2026-04-19 e22c616e4e87914135c1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-arrayArea: `[T; N]`A-boxArea: Our favorite opsem complicationA-iteratorsArea: IteratorsC-enhancementCategory: An issue proposing an enhancement or a PR with one.F-negative_impls#![feature(negative_impls)]T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions