Skip to content

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

New issue

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

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

Already on GitHub? # to your account

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.

japaric pushed a commit to japaric/rust that referenced this issue Nov 17, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Feb 10, 2025
fix: In completion's expand, consider recursion stop condition (when we're not inside a macro call anymore) *after* the recursive call instead of before it
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants