Skip to content

Commit 8f59a2d

Browse files
committed
---
yaml --- r: 136671 b: refs/heads/dist-snap c: 1c7d253 h: refs/heads/master i: 136669: 6b5e262 136667: c0ee820 136663: 4ee73ce 136655: a7f038e 136639: 0647e1d v: v3
1 parent ecff9f8 commit 8f59a2d

File tree

7 files changed

+26
-13
lines changed

7 files changed

+26
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 189b7332968972f34cdbbbd9b62d97ababf53059
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 45f4081e61a1a15e2b5b9c5a09976fddffdac9dc
9+
refs/heads/dist-snap: 1c7d253ca3601d2f9caddc52e66bfc1de3bdd441
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/doc/guide-unsafe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ Other features provided by lang items include:
706706
`==`, `<`, dereferencing (`*`) and `+` (etc.) operators are all
707707
marked with lang items; those specific four are `eq`, `ord`,
708708
`deref`, and `add` respectively.
709-
- stack unwinding and general failure; the `eh_personality`, `fail_`
709+
- stack unwinding and general failure; the `eh_personality`, `fail`
710710
and `fail_bounds_checks` lang items.
711711
- the traits in `std::kinds` used to indicate types that satisfy
712712
various kinds; lang items `send`, `sync` and `copy`.

branches/dist-snap/src/libcore/failure.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
use fmt;
3434
use intrinsics;
3535

36+
// NOTE: remove after next snapshot
37+
#[cfg(stage0)]
3638
#[cold] #[inline(never)] // this is the slow path, always
3739
#[lang="fail_"]
3840
fn fail_(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
@@ -45,6 +47,19 @@ fn fail_(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
4547
unsafe { intrinsics::abort() }
4648
}
4749

50+
#[cfg(not(stage0))]
51+
#[cold] #[inline(never)] // this is the slow path, always
52+
#[lang="fail"]
53+
fn fail(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
54+
let (expr, file, line) = *expr_file_line;
55+
let ref file_line = (file, line);
56+
format_args!(|args| -> () {
57+
fail_impl(args, file_line);
58+
}, "{}", expr);
59+
60+
unsafe { intrinsics::abort() }
61+
}
62+
4863
#[cold] #[inline(never)]
4964
#[lang="fail_bounds_check"]
5065
fn fail_bounds_check(file_line: &(&'static str, uint),
@@ -65,6 +80,7 @@ pub fn fail_impl(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
6580
#[allow(ctypes)]
6681
extern {
6782

83+
// NOTE: remove after next snapshot
6884
#[cfg(stage0)]
6985
#[lang = "begin_unwind"]
7086
fn fail_impl(fmt: &fmt::Arguments, file: &'static str,
@@ -79,4 +95,3 @@ pub fn fail_impl(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
7995
let (file, line) = *file_line;
8096
unsafe { fail_impl(fmt, file, line) }
8197
}
82-

branches/dist-snap/src/librustc/middle/lang_items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ lets_do_this! {
264264

265265
StrEqFnLangItem, "str_eq", str_eq_fn;
266266

267-
// A number of failure-related lang items. The `fail_` item corresponds to
267+
// A number of failure-related lang items. The `fail` item corresponds to
268268
// divide-by-zero and various failure cases with `match`. The
269269
// `fail_bounds_check` item is for indexing arrays.
270270
//
@@ -273,7 +273,7 @@ lets_do_this! {
273273
// defined to use it, but a final product is required to define it
274274
// somewhere. Additionally, there are restrictions on crates that use a weak
275275
// lang item, but do not have it defined.
276-
FailFnLangItem, "fail_", fail_fn;
276+
FailFnLangItem, "fail", fail_fn;
277277
FailBoundsCheckFnLangItem, "fail_bounds_check", fail_bounds_check_fn;
278278
FailFmtLangItem, "fail_fmt", fail_fmt;
279279

branches/dist-snap/src/librustrt/unwind.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,24 +488,22 @@ pub mod eabi {
488488
}
489489

490490
// Entry point of failure from the libcore crate
491-
#[cfg(not(test))]
492-
#[cfg(not(stage0))]
491+
#[cfg(not(test), not(stage0))]
493492
#[lang = "fail_fmt"]
494-
pub extern fn rust_begin_unwind1(msg: &fmt::Arguments,
493+
pub extern fn rust_begin_unwind(msg: &fmt::Arguments,
495494
file: &'static str, line: uint) -> ! {
496495
begin_unwind_fmt(msg, &(file, line))
497496
}
497+
498498
//
499499
// Entry point of failure from the libcore crate
500-
#[cfg(not(test))]
501-
#[cfg(stage0)]
500+
#[cfg(stage0, not(test))]
502501
#[lang = "begin_unwind"]
503502
pub extern fn rust_begin_unwind(msg: &fmt::Arguments,
504503
file: &'static str, line: uint) -> ! {
505504
begin_unwind_fmt(msg, &(file, line))
506505
}
507506

508-
509507
/// The entry point for unwinding with a formatted message.
510508
///
511509
/// This is designed to reduce the amount of code required at the call

branches/dist-snap/src/test/auxiliary/lang-item-public.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![no_std]
1212
#![feature(lang_items)]
1313

14-
#[lang="fail_"]
14+
#[lang="fail"]
1515
fn fail(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
1616

1717
#[lang = "stack_exhausted"]

branches/dist-snap/src/test/compile-fail/lint-dead-code-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ fn g() { h(); }
104104
fn h() {}
105105

106106
// Similarly, lang items are live
107-
#[lang="fail_"]
107+
#[lang="fail"]
108108
fn fail(_: *const u8, _: *const u8, _: uint) -> ! { loop {} }

0 commit comments

Comments
 (0)