auto merge of #5610 : thestinger/rust/tutorial, r=pcwalton
This commit is contained in:
commit
d98a195ffc
1 changed files with 5 additions and 6 deletions
|
@ -875,8 +875,7 @@ the compiler that unsafety does not leak outside of the unsafe block, and is
|
|||
used to create safe concepts on top of low-level code.
|
||||
|
||||
~~~~
|
||||
use core::libc::funcs::c95::stdlib::{calloc, free};
|
||||
use core::libc::types::os::arch::c95::size_t;
|
||||
use core::libc::{calloc, free, size_t};
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
|
@ -909,9 +908,7 @@ The unsafe code from above can be contained behind a safe API that prevents
|
|||
memory leaks or use-after-free:
|
||||
|
||||
~~~~
|
||||
use core::libc::funcs::c95::stdlib::{calloc, free};
|
||||
use core::libc::types::common::c95::c_void;
|
||||
use core::libc::types::os::arch::c95::size_t;
|
||||
use core::libc::{calloc, free, c_void, size_t};
|
||||
|
||||
struct Blob { priv ptr: *c_void }
|
||||
|
||||
|
@ -985,7 +982,9 @@ when it is collected.
|
|||
|
||||
If an object doesn't contain garbage-collected boxes, it consists of a single
|
||||
ownership tree and is given the `Owned` trait which allows it to be sent
|
||||
between tasks.
|
||||
between tasks. Custom destructors can only be implemented directly on types
|
||||
that are `Owned`, but garbage-collected boxes can still *contain* types with
|
||||
custom destructors.
|
||||
|
||||
# Boxes
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue