Skip to content

Can't clone &T when T is unsized #19037

Closed
@japaric

Description

@japaric

STR

Found while attempting #19036

struct Str([u8]);

#[deriving(Clone)]
struct CharSplits<'a, Sep> {
    string: &'a Str,
    //~^ error: the trait `core::kinds::Sized` is not implemented for the type `Str`
    sep: Sep,
    allow_trailing_empty: bool,
    only_ascii: bool,
    finished: bool,
}

fn clone(s: &Str) -> &Str {
    Clone::clone(&s)
    //~^ error: the trait `core::kinds::Sized` is not implemented for the type `Str`
}

fn main() {}

We need to DSTify the impl<'a, T> Clone for &'a T

cc @aturon
cc #16918

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions