Skip to content

&[Trait] should probably not be allowed #21748

Closed
@Ms2ger

Description

@Ms2ger

This compiles:

trait Reader {}
fn perform(readers: &[Reader]) -> usize { 0 }

and this complains that there is no len():

trait Reader {}
fn perform(readers: &[Reader]) -> usize { readers.len() }

It seems to me like both should fail to compile with an error about sticking DSTs in a slice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)A-type-systemArea: Type system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions