Skip to content

Slicing syntax should work for &&[T] #17503

Closed
@nrc

Description

@nrc
Member

Probably. At least (*foo)[..42] is pretty ugly

Either we implement Slice for &[T] (currently only implemented for [T]) or we do the same autoref/deref for slices as we do for method call.

Activity

sfackler

sfackler commented on Oct 5, 2014

@sfackler
Member

It should also work through Deref.

japaric

japaric commented on Nov 7, 2014

@japaric
Member

This seems to be working:

#![feature(slicing_syntax)]

fn main() {
    let s: &[int] = &[0, 1, 2, 3, 4];
    let ss: &&[int] = &s;
    let sss: &&&[int] = &ss;

    println!("{}", s[..3]);
    println!("{}", ss[3..]);
    println!("{}", sss[2..4]);
}

As of:

rustc 0.13.0-dev (e84e7a00d 2014-11-06 08:06:50 +0000)
alexcrichton

alexcrichton commented on Nov 7, 2014

@alexcrichton
Member

Flagging as needtest.

added
E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
on Nov 7, 2014
added 3 commits that reference this issue on Dec 12, 2014
20cbbff
c59b9b7
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

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @alexcrichton@nrc@sfackler@japaric

      Issue actions

        Slicing syntax should work for &&[T] · Issue #17503 · rust-lang/rust