Skip to content

Commit 2a1ebdd

Browse files
committed
---
yaml --- r: 155134 b: refs/heads/try2 c: eafeb33 h: refs/heads/master v: v3
1 parent e138b30 commit 2a1ebdd

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 48bc291a80085978987d13f75b70b82b69ec9b4d
8+
refs/heads/try2: eafeb335a0731b4bfcd8be6203d0d29a3668cd76
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/guide-unsafe.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,12 @@ fn start(_argc: int, _argv: *const *const u8) -> int {
461461
0
462462
}
463463
464-
// These functions are invoked by the compiler, but not
464+
// These functions and traits are used by the compiler, but not
465465
// for a bare-bones hello world. These are normally
466466
// provided by libstd.
467467
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
468468
#[lang = "eh_personality"] extern fn eh_personality() {}
469+
#[lang = "sized"] trait Sized { }
469470
# // fn main() {} tricked you, rustdoc!
470471
```
471472

@@ -488,13 +489,14 @@ pub extern fn main(argc: int, argv: *const *const u8) -> int {
488489
489490
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
490491
#[lang = "eh_personality"] extern fn eh_personality() {}
492+
#[lang = "sized"] trait Sized { }
491493
# // fn main() {} tricked you, rustdoc!
492494
```
493495

494496

495497
The compiler currently makes a few assumptions about symbols which are available
496498
in the executable to call. Normally these functions are provided by the standard
497-
library, but without it you must define your own.
499+
xlibrary, but without it you must define your own.
498500

499501
The first of these two functions, `stack_exhausted`, is invoked whenever stack
500502
overflow is detected. This function has a number of restrictions about how it
@@ -508,6 +510,12 @@ mechanisms of the compiler. This is often mapped to GCC's personality function
508510
information), but crates which do not trigger failure can be assured that this
509511
function is never called.
510512

513+
The final item in the example is a trait called `Sized`. This a trait
514+
that represents data of a known static size: it is integral to the
515+
Rust type system, and so the compiler expects the standard library to
516+
provide it. Since you are not using the standard library, you have to
517+
provide it yourself.
518+
511519
## Using libcore
512520

513521
> **Note**: the core library's structure is unstable, and it is recommended to
@@ -686,6 +694,7 @@ fn main(argc: int, argv: *const *const u8) -> int {
686694
687695
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
688696
#[lang = "eh_personality"] extern fn eh_personality() {}
697+
#[lang = "sized"] trait Sized {}
689698
```
690699

691700
Note the use of `abort`: the `exchange_malloc` lang item is assumed to

0 commit comments

Comments
 (0)