Rename main thread from "<main>" to "main".

Fix issue #33789
This commit is contained in:
Wangshan Lu 2016-05-22 22:36:55 +08:00
parent e24d621fca
commit 226bcdf7d1
27 changed files with 31 additions and 31 deletions

View file

@ -134,7 +134,7 @@ $ ldd example
not a dynamic executable
$ ./example
hi!
thread '<main>' panicked at 'failed', example.rs:1
thread 'main' panicked at 'failed', example.rs:1
```
Success! This binary can be copied to almost any Linux machine with the same

View file

@ -81,7 +81,7 @@ fn main() {
If you try running this code, the program will crash with a message like this:
```text
thread '<main>' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
thread 'main' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
```
Here's another example that is slightly less contrived. A program that accepts
@ -498,7 +498,7 @@ At this point, you should be skeptical of calling `unwrap`. For example, if
the string doesn't parse as a number, you'll get a panic:
```text
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/libcore/result.rs:729
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/libcore/result.rs:729
```
This is rather unsightly, and if this happened inside a library you're

View file

@ -221,7 +221,7 @@ If you add a main function that calls `diverges()` and run it, youll get
some output that looks like this:
```text
thread <main> panicked at This function never returns!, hello.rs:2
thread main panicked at This function never returns!, hello.rs:2
```
If you want more information, you can get a backtrace by setting the
@ -229,7 +229,7 @@ If you want more information, you can get a backtrace by setting the
```text
$ RUST_BACKTRACE=1 ./diverges
thread '<main>' panicked at 'This function never returns!', hello.rs:2
thread 'main' panicked at 'This function never returns!', hello.rs:2
stack backtrace:
1: 0x7f402773a829 - sys::backtrace::write::h0942de78b6c02817K8r
2: 0x7f402773d7fc - panicking::on_panic::h3f23f9d0b5f4c91bu9w
@ -255,7 +255,7 @@ Any other value(even no value at all) turns on backtrace.
$ export RUST_BACKTRACE=1
...
$ RUST_BACKTRACE=0 ./diverges
thread '<main>' panicked at 'This function never returns!', hello.rs:2
thread 'main' panicked at 'This function never returns!', hello.rs:2
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```
@ -264,7 +264,7 @@ note: Run with `RUST_BACKTRACE=1` for a backtrace.
```text
$ RUST_BACKTRACE=1 cargo run
Running `target/debug/diverges`
thread '<main>' panicked at 'This function never returns!', hello.rs:2
thread 'main' panicked at 'This function never returns!', hello.rs:2
stack backtrace:
1: 0x7f402773a829 - sys::backtrace::write::h0942de78b6c02817K8r
2: 0x7f402773d7fc - panicking::on_panic::h3f23f9d0b5f4c91bu9w

View file

@ -806,7 +806,7 @@ You guessed: 59
You win!
Please input your guess.
quit
thread '<main>' panicked at 'Please type a number!'
thread 'main' panicked at 'Please type a number!'
```
Ha! `quit` actually quits. As does any other non-number input. Well, this is

View file

@ -163,7 +163,7 @@ let hachi = &dog[0..2];
with this error:
```text
thread '<main>' panicked at 'index 0 and/or 2 in `忠犬ハチ公` do not lie on
thread 'main' panicked at 'index 0 and/or 2 in `忠犬ハチ公` do not lie on
character boundary'
```

View file

@ -107,7 +107,7 @@ failures:
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
thread '<main>' panicked at 'Some tests failed', /home/steve/src/rust/src/libtest/lib.rs:247
thread 'main' panicked at 'Some tests failed', /home/steve/src/rust/src/libtest/lib.rs:247
```
Rust indicates that our test failed:

View file

@ -79,7 +79,7 @@ println!("Item 7 is {}", v[7]);
then the current thread will [panic] with a message like this:
```text
thread '<main>' panicked at 'index out of bounds: the len is 3 but the index is 7'
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 7'
```
If you want to handle out-of-bounds errors without panicking, you can use