Skip to content

Commit 6473909

Browse files
committed
Fix various places that were affected by adding core as dep of libc
1 parent ca8e563 commit 6473909

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

src/doc/guide-unsafe.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ fn start(_argc: int, _argv: *const *const u8) -> int {
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 { }
469+
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
470470
# // fn main() {} tricked you, rustdoc!
471471
```
472472

@@ -489,32 +489,28 @@ pub extern fn main(argc: int, argv: *const *const u8) -> int {
489489
490490
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
491491
#[lang = "eh_personality"] extern fn eh_personality() {}
492-
#[lang = "sized"] trait Sized { }
492+
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
493493
# // fn main() {} tricked you, rustdoc!
494494
```
495495

496496

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

501-
The first of these two functions, `stack_exhausted`, is invoked whenever stack
501+
The first of these three functions, `stack_exhausted`, is invoked whenever stack
502502
overflow is detected. This function has a number of restrictions about how it
503503
can be called and what it must do, but if the stack limit register is not being
504504
maintained then a task always has an "infinite stack" and this function
505505
shouldn't get triggered.
506506

507-
The second of these two functions, `eh_personality`, is used by the failure
508-
mechanisms of the compiler. This is often mapped to GCC's personality function
509-
(see the [libstd implementation](std/rt/unwind/index.html) for more
510-
information), but crates which do not trigger failure can be assured that this
511-
function is never called.
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.
507+
The second of these three functions, `eh_personality`, is used by the
508+
failure mechanisms of the compiler. This is often mapped to GCC's
509+
personality function (see the
510+
[libstd implementation](std/rt/unwind/index.html) for more
511+
information), but crates which do not trigger failure can be assured
512+
that this function is never called. The final function, `fail_fmt`, is
513+
also used by the failure mechanisms of the compiler.
518514

519515
## Using libcore
520516

@@ -694,7 +690,7 @@ fn main(argc: int, argv: *const *const u8) -> int {
694690
695691
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
696692
#[lang = "eh_personality"] extern fn eh_personality() {}
697-
#[lang = "sized"] trait Sized {}
693+
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
698694
```
699695

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

src/test/run-make/no-duplicate-libs/bar.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ pub extern fn bar() {}
1919

2020
#[lang = "stack_exhausted"] fn stack_exhausted() {}
2121
#[lang = "eh_personality"] fn eh_personality() {}
22+
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }

src/test/run-make/no-duplicate-libs/foo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ pub extern fn foo() {}
1919

2020
#[lang = "stack_exhausted"] fn stack_exhausted() {}
2121
#[lang = "eh_personality"] fn eh_personality() {}
22+
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }

src/test/run-pass/smallest-hello-world.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "rust-intrinsic" { fn transmute<T, U>(t: T) -> U; }
2222

2323
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
2424
#[lang = "eh_personality"] extern fn eh_personality() {}
25-
#[lang = "sized"] pub trait Sized {}
25+
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
2626

2727
#[start]
2828
#[no_split_stack]

0 commit comments

Comments
 (0)