@@ -461,11 +461,12 @@ fn start(_argc: int, _argv: *const *const u8) -> int {
461
461
0
462
462
}
463
463
464
- // These functions are invoked by the compiler, but not
464
+ // These functions and traits are used by the compiler, but not
465
465
// for a bare-bones hello world. These are normally
466
466
// provided by libstd.
467
467
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
468
468
#[lang = "eh_personality"] extern fn eh_personality() {}
469
+ #[lang = "sized"] trait Sized { }
469
470
# // fn main() {} tricked you, rustdoc!
470
471
```
471
472
@@ -488,13 +489,14 @@ pub extern fn main(argc: int, argv: *const *const u8) -> int {
488
489
489
490
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
490
491
#[lang = "eh_personality"] extern fn eh_personality() {}
492
+ #[lang = "sized"] trait Sized { }
491
493
# // fn main() {} tricked you, rustdoc!
492
494
```
493
495
494
496
495
497
The compiler currently makes a few assumptions about symbols which are available
496
498
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.
498
500
499
501
The first of these two functions, ` stack_exhausted ` , is invoked whenever stack
500
502
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
508
510
information), but crates which do not trigger failure can be assured that this
509
511
function is never called.
510
512
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
+
511
519
## Using libcore
512
520
513
521
> ** 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 {
686
694
687
695
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
688
696
#[lang = "eh_personality"] extern fn eh_personality() {}
697
+ #[lang = "sized"] trait Sized {}
689
698
```
690
699
691
700
Note the use of ` abort ` : the ` exchange_malloc ` lang item is assumed to
0 commit comments