Skip to content

Commit 226bcdf

Browse files
committed
Rename main thread from "<main>" to "main".
Fix issue #33789
1 parent e24d621 commit 226bcdf

27 files changed

+31
-31
lines changed

src/doc/book/advanced-linking.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ $ ldd example
134134
not a dynamic executable
135135
$ ./example
136136
hi!
137-
thread '<main>' panicked at 'failed', example.rs:1
137+
thread 'main' panicked at 'failed', example.rs:1
138138
```
139139

140140
Success! This binary can be copied to almost any Linux machine with the same

src/doc/book/error-handling.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn main() {
8181
If you try running this code, the program will crash with a message like this:
8282

8383
```text
84-
thread '<main>' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
84+
thread 'main' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
8585
```
8686

8787
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
498498
the string doesn't parse as a number, you'll get a panic:
499499

500500
```text
501-
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
501+
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
502502
```
503503

504504
This is rather unsightly, and if this happened inside a library you're

src/doc/book/functions.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ If you add a main function that calls `diverges()` and run it, you’ll get
221221
some output that looks like this:
222222

223223
```text
224-
thread ‘<main>’ panicked at ‘This function never returns!’, hello.rs:2
224+
thread ‘main’ panicked at ‘This function never returns!’, hello.rs:2
225225
```
226226

227227
If you want more information, you can get a backtrace by setting the
228228
`RUST_BACKTRACE` environment variable:
229229

230230
```text
231231
$ RUST_BACKTRACE=1 ./diverges
232-
thread '<main>' panicked at 'This function never returns!', hello.rs:2
232+
thread 'main' panicked at 'This function never returns!', hello.rs:2
233233
stack backtrace:
234234
1: 0x7f402773a829 - sys::backtrace::write::h0942de78b6c02817K8r
235235
2: 0x7f402773d7fc - panicking::on_panic::h3f23f9d0b5f4c91bu9w
@@ -255,7 +255,7 @@ Any other value(even no value at all) turns on backtrace.
255255
$ export RUST_BACKTRACE=1
256256
...
257257
$ RUST_BACKTRACE=0 ./diverges
258-
thread '<main>' panicked at 'This function never returns!', hello.rs:2
258+
thread 'main' panicked at 'This function never returns!', hello.rs:2
259259
note: Run with `RUST_BACKTRACE=1` for a backtrace.
260260
```
261261

@@ -264,7 +264,7 @@ note: Run with `RUST_BACKTRACE=1` for a backtrace.
264264
```text
265265
$ RUST_BACKTRACE=1 cargo run
266266
Running `target/debug/diverges`
267-
thread '<main>' panicked at 'This function never returns!', hello.rs:2
267+
thread 'main' panicked at 'This function never returns!', hello.rs:2
268268
stack backtrace:
269269
1: 0x7f402773a829 - sys::backtrace::write::h0942de78b6c02817K8r
270270
2: 0x7f402773d7fc - panicking::on_panic::h3f23f9d0b5f4c91bu9w

src/doc/book/guessing-game.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ You guessed: 59
806806
You win!
807807
Please input your guess.
808808
quit
809-
thread '<main>' panicked at 'Please type a number!'
809+
thread 'main' panicked at 'Please type a number!'
810810
```
811811
812812
Ha! `quit` actually quits. As does any other non-number input. Well, this is

src/doc/book/strings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ let hachi = &dog[0..2];
163163
with this error:
164164

165165
```text
166-
thread '<main>' panicked at 'index 0 and/or 2 in `忠犬ハチ公` do not lie on
166+
thread 'main' panicked at 'index 0 and/or 2 in `忠犬ハチ公` do not lie on
167167
character boundary'
168168
```
169169

src/doc/book/testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ failures:
107107

108108
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
109109

110-
thread '<main>' panicked at 'Some tests failed', /home/steve/src/rust/src/libtest/lib.rs:247
110+
thread 'main' panicked at 'Some tests failed', /home/steve/src/rust/src/libtest/lib.rs:247
111111
```
112112

113113
Rust indicates that our test failed:

src/doc/book/vectors.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ println!("Item 7 is {}", v[7]);
7979
then the current thread will [panic] with a message like this:
8080

8181
```text
82-
thread '<main>' panicked at 'index out of bounds: the len is 3 but the index is 7'
82+
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 7'
8383
```
8484

8585
If you want to handle out-of-bounds errors without panicking, you can use

src/libstd/rt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
5151
// created. Note that this isn't necessary in general for new threads,
5252
// but we just do this to name the main thread and to give it correct
5353
// info about the stack bounds.
54-
let thread: Thread = NewThread::new(Some("<main>".to_owned()));
54+
let thread: Thread = NewThread::new(Some("main".to_owned()));
5555
thread_info::set(main_guard, thread);
5656

5757
// Store our args if necessary in a squirreled away location

src/test/run-fail/main-panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:thread '<main>' panicked at
11+
// error-pattern:thread 'main' panicked at
1212

1313
fn main() {
1414
panic!()

src/test/run-fail/overflowing-add.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'arithmetic operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616

src/test/run-fail/overflowing-lsh-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![warn(exceeding_bitshifts)]

src/test/run-fail/overflowing-lsh-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![warn(exceeding_bitshifts)]

src/test/run-fail/overflowing-lsh-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![warn(exceeding_bitshifts)]

src/test/run-fail/overflowing-lsh-4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
// This function is checking that our automatic truncation does not

src/test/run-fail/overflowing-mul.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'arithmetic operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![feature(rustc_attrs)]

src/test/run-fail/overflowing-neg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'attempted to negate with overflow'
13+
// error-pattern:thread 'main' panicked at 'attempted to negate with overflow'
1414
// compile-flags: -C debug-assertions
1515

1616
#![feature(rustc_attrs)]

src/test/run-fail/overflowing-pow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
11+
// error-pattern:thread 'main' panicked at 'arithmetic operation overflowed'
1212
// compile-flags: -C debug-assertions
1313

1414
fn main() {

src/test/run-fail/overflowing-rsh-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![warn(exceeding_bitshifts)]

src/test/run-fail/overflowing-rsh-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![warn(exceeding_bitshifts)]

src/test/run-fail/overflowing-rsh-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![warn(exceeding_bitshifts)]

src/test/run-fail/overflowing-rsh-4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
// This function is checking that our (type-based) automatic

src/test/run-fail/overflowing-rsh-5.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![warn(exceeding_bitshifts)]

src/test/run-fail/overflowing-rsh-6.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'shift operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'shift operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![warn(exceeding_bitshifts)]

src/test/run-fail/overflowing-sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// ignore-pretty : (#23623) problems when ending with // comments
1212

13-
// error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
13+
// error-pattern:thread 'main' panicked at 'arithmetic operation overflowed'
1414
// compile-flags: -C debug-assertions
1515

1616
#![feature(rustc_attrs)]

src/test/run-fail/panic-set-unset-handler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:thread '<main>' panicked at 'foobar'
11+
// error-pattern:thread 'main' panicked at 'foobar'
1212

1313
#![feature(std_panic, panic_handler)]
1414
use std::panic;

src/test/run-fail/panic-take-handler-nop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:thread '<main>' panicked at 'foobar'
11+
// error-pattern:thread 'main' panicked at 'foobar'
1212

1313
#![feature(std_panic, panic_handler)]
1414
use std::panic;

src/test/run-pass/multi-panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn check_for_no_backtrace(test: std::process::Output) {
1515

1616
assert_eq!(it.next().map(|l| l.starts_with("thread '<unnamed>' panicked at")), Some(true));
1717
assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=1` for a backtrace."));
18-
assert_eq!(it.next().map(|l| l.starts_with("thread '<main>' panicked at")), Some(true));
18+
assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true));
1919
assert_eq!(it.next(), None);
2020
}
2121

0 commit comments

Comments
 (0)