@@ -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
495497The compiler currently makes a few assumptions about symbols which are available
496498in 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
499501The first of these two functions, ` stack_exhausted ` , is invoked whenever stack
500502overflow 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
508510information), but crates which do not trigger failure can be assured that this
509511function 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
691700Note the use of ` abort ` : the ` exchange_malloc ` lang item is assumed to
0 commit comments