-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
#[derive(Clone)] should explicitly override clone_from
#13281
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
Comments
Triage: no change that i'm aware of. |
3 tasks
Seems like we could close this issue (see reasoning in #27939). |
Mark-Simulacrum
added
the
I-slow
Issue: Problems and improvements with respect to performance of generated code.
label
Jun 13, 2017
Mark-Simulacrum
added
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
and removed
I-papercut
labels
Jul 20, 2017
dtolnay
changed the title
#[deriving(Clone)] should explicitly override
#[derive(Clone)] should explicitly override Dec 3, 2017
clone_from
clone_from
The reasoning in #27939 still applies as to why this should not be provided by the built-in derive(Clone). A custom derive for clone_from is provided in the |
Jarcho
pushed a commit
to Jarcho/rust
that referenced
this issue
Aug 24, 2024
Trigger [`string_slice`] if expression is reference to `&str` Close rust-lang#12708 changelog: [`string_slice`]: trigger lint if expression is reference to `&str`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
This would mean derived clone implementations can reuse the resources of interior types (especially important with types containing things like
Vec
) when cloning into an already-created instance.Currently doing this is difficult with how
#[deriving]
works internally (needs a mutable borrow of the contents ofself
, and needs to avoid borrowingself
for enum variants that mismatch or else the requisite*self = other.clone()
implementation won't work).The text was updated successfully, but these errors were encountered: