Skip to content

Commit a9e7669

Browse files
committed
Rebasing fixes.
1 parent f4c0c0f commit a9e7669

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

src/libstd/rt/unwind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static CALLBACKS: [atomic::AtomicUint, ..MAX_CALLBACKS] =
9494
atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT];
9595
static CALLBACK_CNT: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT;
9696

97-
thread_local!(static PANICKING: Cell<bool> = Cell::new(false))
97+
thread_local! { static PANICKING: Cell<bool> = Cell::new(false) }
9898

9999
/// Invoke a closure, capturing the cause of panic if one occurs.
100100
///

src/libstd/sys/common/backtrace.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,18 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
4040
// expecting, we just print it literally. Note that we must handle non-rust
4141
// symbols because we could have any function in the backtrace.
4242
let mut valid = true;
43+
let mut inner = s;
4344
if s.len() > 4 && s.starts_with("_ZN") && s.ends_with("E") {
44-
let mut chars = s.slice(3, s.len() - 1).chars();
45+
inner = s.slice(3, s.len() - 1);
46+
// On Windows, dbghelp strips leading underscores, so we accept "ZN...E" form too.
47+
} else if s.len() > 3 && s.starts_with("ZN") && s.ends_with("E") {
48+
inner = s.slice(2, s.len() - 1);
49+
} else {
50+
valid = false;
51+
}
52+
53+
if valid {
54+
let mut chars = inner.chars();
4555
while valid {
4656
let mut i = 0;
4757
for c in chars {
@@ -58,32 +68,29 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
5868
valid = false;
5969
}
6070
}
61-
} else {
62-
valid = false;
6371
}
6472

6573
// Alright, let's do this.
6674
if !valid {
6775
try!(writer.write_str(s));
6876
} else {
69-
let mut s = s.slice_from(3);
7077
let mut first = true;
71-
while s.len() > 1 {
78+
while inner.len() > 0 {
7279
if !first {
7380
try!(writer.write_str("::"));
7481
} else {
7582
first = false;
7683
}
77-
let mut rest = s;
84+
let mut rest = inner;
7885
while rest.char_at(0).is_numeric() {
7986
rest = rest.slice_from(1);
8087
}
81-
let i: uint = from_str(s.slice_to(s.len() - rest.len())).unwrap();
82-
s = rest.slice_from(i);
88+
let i: uint = from_str(inner.slice_to(inner.len() - rest.len())).unwrap();
89+
inner = rest.slice_from(i);
8390
rest = rest.slice_to(i);
8491
while rest.len() > 0 {
8592
if rest.starts_with("$") {
86-
macro_rules! demangle(
93+
macro_rules! demangle {
8794
($($pat:expr => $demangled:expr),*) => ({
8895
$(if rest.starts_with($pat) {
8996
try!(writer.write_str($demangled));
@@ -95,7 +102,8 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
95102
}
96103

97104
})
98-
)
105+
}
106+
99107
// see src/librustc/back/link.rs for these mappings
100108
demangle! (
101109
"$SP$" => "@",

src/libstd/sys/common/thread_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct ThreadInfo {
2323
thread: Thread,
2424
}
2525

26-
thread_local!(static THREAD_INFO: RefCell<Option<ThreadInfo>> = RefCell::new(None))
26+
thread_local! { static THREAD_INFO: RefCell<Option<ThreadInfo>> = RefCell::new(None) }
2727

2828
impl ThreadInfo {
2929
fn with<R>(f: |&mut ThreadInfo| -> R) -> R {

src/libstd/sys/windows/backtrace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,12 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
304304
Err(..) => return Ok(()),
305305
};
306306

307-
macro_rules! sym( ($e:expr, $t:ident) => (unsafe {
307+
macro_rules! sym{ ($e:expr, $t:ident) => (unsafe {
308308
match lib.symbol($e) {
309309
Ok(f) => mem::transmute::<*mut u8, $t>(f),
310310
Err(..) => return Ok(())
311311
}
312-
}) )
312+
}) }
313313

314314
// Fetch the symbols necessary from dbghelp.dll
315315
let SymFromAddr = sym!("SymFromAddr", SymFromAddrFn);

0 commit comments

Comments
 (0)