Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
japaric opened this issue Nov 17, 2014 · 1 comment · Fixed by #19041
Closed

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

japaric opened this issue Nov 17, 2014 · 1 comment · Fixed by #19041

Comments

@japaric
Copy link
Member

japaric commented Nov 17, 2014

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

@aturon
Copy link
Member

aturon commented Nov 17, 2014

@japaric Note, this is one of the cases that came up with git grep "impl.*for &" -- would be good to finish going through those impls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants