Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upObjects can be dropped an arbitrary number of times in safe code #25549
Comments
Thiez
changed the title
Types can be dropped an arbitrary number of times in safe code
Objects can be dropped an arbitrary number of times in safe code
May 17, 2015
sfackler
added
I-wrong
I-crash
I-nominated
labels
May 18, 2015
This comment has been minimized.
This comment has been minimized.
|
Nominating for P-high |
This comment has been minimized.
This comment has been minimized.
|
cc @pnkfelix |
This comment has been minimized.
This comment has been minimized.
|
Too bad this doesn't just cancel out the Leakocalypse |
This comment has been minimized.
This comment has been minimized.
(well, any object that implements |
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix look, no fn drop_n_times<T>(val: T, times: u32) {
struct Holder<T: ?Sized>(T);
let container = Holder([val]);
for _ in 0..times {
&(*(&container as &Holder<[T]>)).0;
}
} |
This comment has been minimized.
This comment has been minimized.
|
to be clear, I am looking at this now as well. :) |
This comment has been minimized.
This comment has been minimized.
|
I guess #22815 is related. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix Yeah, it's unrelated. The |
dotdash
added a commit
to dotdash/rust
that referenced
this issue
May 19, 2015
dotdash
referenced this issue
May 19, 2015
Merged
Don't call drop when taking the address of unsized fields #25595
dotdash
added a commit
to dotdash/rust
that referenced
this issue
May 19, 2015
bors
added a commit
that referenced
this issue
May 20, 2015
bors
closed this
in
#25595
May 20, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thiez commentedMay 17, 2015
The following function can drop any object arbitrary number of times, using only safe code:
Probably bad :)
Found while researching #25515