<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/liballoc/boxed.rs, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2020-07-28T00:51:13+00:00</updated>
<entry>
<title>mv std libs to library/</title>
<updated>2020-07-28T00:51:13+00:00</updated>
<author>
<name>mark</name>
<email>markm@cs.wisc.edu</email>
</author>
<published>2020-06-12T02:31:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2c31b45ae878b821975c4ebd94cc1e49f6073fd0'/>
<id>urn:sha1:2c31b45ae878b821975c4ebd94cc1e49f6073fd0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove the usage of the LengthAtMost32 trait</title>
<updated>2020-07-05T12:47:08+00:00</updated>
<author>
<name>Roman Proskuryakov</name>
<email>humbug@deeptown.org</email>
</author>
<published>2020-07-05T12:02:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=eff62069ad602090e8d27b83cffd9e77479ed4be'/>
<id>urn:sha1:eff62069ad602090e8d27b83cffd9e77479ed4be</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #73678 - Keno:patch-1, r=LukasKalbertodt</title>
<updated>2020-07-01T14:42:42+00:00</updated>
<author>
<name>Manish Goregaokar</name>
<email>manishsmail@gmail.com</email>
</author>
<published>2020-07-01T14:42:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6556f269918124b43db67367867c6930cb3189c9'/>
<id>urn:sha1:6556f269918124b43db67367867c6930cb3189c9</id>
<content type='text'>
Update Box::from_raw example to generalize better

I know very little about rust, so I saw the example here
```
use std::alloc::{alloc, Layout};

unsafe {
    let ptr = alloc(Layout::new::&lt;i32&gt;()) as *mut i32;
    *ptr = 5;
    let x = Box::from_raw(ptr);
}
```
and tried to generalize it by writing,
```
    let layout = Layout::new::&lt;T&gt;();
    let new_obj = unsafe {
        let ptr = alloc(layout) as *mut T;
        *ptr = obj;
        Box::from_raw(ptr)
    };
```
for some more complicated `T`, which ended up crashing with SIGSEGV,
because it tried to `drop_in_place` the previous object in `ptr` which is
of course garbage. I think that changing this example to use `.write` instead
would be a good idea to suggest the correct generalization. It is also more
consistent with other documentation items in this file, which use `.write`.
I also added a comment to explain it, but I'm not too attached to that,
and can see it being too verbose in this place.
</content>
</entry>
<entry>
<title>lints: add `improper_ctypes_definitions`</title>
<updated>2020-06-24T11:09:35+00:00</updated>
<author>
<name>David Wood</name>
<email>david@davidtw.co</email>
</author>
<published>2020-05-28T14:57:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=14ea7a777f924995256a05da55133d265ed169be'/>
<id>urn:sha1:14ea7a777f924995256a05da55133d265ed169be</id>
<content type='text'>
This commit adds a new lint - `improper_ctypes_definitions` - which
functions identically to `improper_ctypes`, but on `extern "C" fn`
definitions (as opposed to `improper_ctypes`'s `extern "C" {}`
declarations).

Signed-off-by: David Wood &lt;david@davidtw.co&gt;
</content>
</entry>
<entry>
<title>Update Box::from_raw example to generalize better</title>
<updated>2020-06-24T02:42:35+00:00</updated>
<author>
<name>Keno Fischer</name>
<email>keno@alumni.harvard.edu</email>
</author>
<published>2020-06-24T02:42:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=0c88dd663a7095ccc405a2036047a90981137a51'/>
<id>urn:sha1:0c88dd663a7095ccc405a2036047a90981137a51</id>
<content type='text'>
I know very little about rust, so I saw this example and tried to generalize it by writing,
```
    let layout = Layout::new::&lt;T&gt;();
    let new_obj = unsafe {
        let ptr = alloc(layout) as *mut T;
        *ptr = obj;
        Box::from_raw(ptr)
    };
```
for some more complicated `T`, which ended up crashing with SIGSEGV,
because it tried to `drop_in_place` the previous object in `ptr` which is
of course garbage. I also added a comment that explains why `.write`
is used, but I think adding that comment is optional and may be too verbose
here. I do however think that changing this example is a good idea to
suggest the correct generalization. `.write` is also used in most of the rest
of the documentation here, even if the example is `i32`, so it would additionally
be more consistent.</content>
</entry>
<entry>
<title>Rollup merge of #72709 - LeSeulArtichaut:unsafe-liballoc, r=nikomatsakis</title>
<updated>2020-06-19T16:14:58+00:00</updated>
<author>
<name>Manish Goregaokar</name>
<email>manishsmail@gmail.com</email>
</author>
<published>2020-06-19T16:14:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=55479de2993195bedafdc2104db21e52709ed137'/>
<id>urn:sha1:55479de2993195bedafdc2104db21e52709ed137</id>
<content type='text'>
`#[deny(unsafe_op_in_unsafe_fn)]` in liballoc

This PR proposes to make use of the new `unsafe_op_in_unsafe_fn` lint, i.e. no longer consider the body of an unsafe function as an unsafe block and require explicit unsafe block to perform unsafe operations.

This has been first (partly) suggested by @Mark-Simulacrum in https://github.com/rust-lang/rust/pull/69245#issuecomment-587817065

Tracking issue for the feature: #71668.
~~Blocked on #71862.~~
r? @Mark-Simulacrum cc @nikomatsakis can you confirm that those changes are desirable? Should I restrict it to only BTree for the moment?
</content>
</entry>
<entry>
<title>`#[deny(unsafe_op_in_unsafe_fn)]` in liballoc</title>
<updated>2020-06-19T11:47:01+00:00</updated>
<author>
<name>LeSeulArtichaut</name>
<email>leseulartichaut@gmail.com</email>
</author>
<published>2020-05-28T21:27:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=39e29ce4d08674734e2f2759607b1486db7d0fde'/>
<id>urn:sha1:39e29ce4d08674734e2f2759607b1486db7d0fde</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Reduce pointer casts in Box::into_boxed_slice</title>
<updated>2020-06-17T23:30:27+00:00</updated>
<author>
<name>Josh Stone</name>
<email>jistone@redhat.com</email>
</author>
<published>2020-06-17T23:30:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a7c2cf8f510788040c4a8a721582a3533d0bf35a'/>
<id>urn:sha1:a7c2cf8f510788040c4a8a721582a3533d0bf35a</id>
<content type='text'>
We only need to cast the pointer once to change `Box&lt;T&gt;` to an array
`Box&lt;[T; 1]&gt;`, then we can let unsized coercion return `Box&lt;[T]&gt;`.
</content>
</entry>
<entry>
<title>Rollup merge of #72499 - mendess:master, r=dtolnay</title>
<updated>2020-05-30T11:45:06+00:00</updated>
<author>
<name>Ralf Jung</name>
<email>post@ralfj.de</email>
</author>
<published>2020-05-30T11:45:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8d64fd80adef2c80325f7a5a545108035198daba'/>
<id>urn:sha1:8d64fd80adef2c80325f7a5a545108035198daba</id>
<content type='text'>
Override Box::&lt;[T]&gt;::clone_from

Avoid dropping and reallocating when cloning to an existing box if the lengths are the same.

It would be nice if this could also be specialized for `Copy` but I don't know how that works since it's not on stable. Will gladly look into it if it's deemed as a good idea.

This is my first PR with code, hope I did everything right :smile:
</content>
</entry>
<entry>
<title>Override Box::&lt;[T]&gt;::clone_from</title>
<updated>2020-05-23T13:08:53+00:00</updated>
<author>
<name>mendess</name>
<email>pedro.mendes.26@gmail.com</email>
</author>
<published>2020-05-23T13:08:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a5734ca41748dfd62904c1b5a1ade7ecd0f9c11e'/>
<id>urn:sha1:a5734ca41748dfd62904c1b5a1ade7ecd0f9c11e</id>
<content type='text'>
</content>
</entry>
</feed>
