Commit Graph

28 Commits

Author SHA1 Message Date
Trevor Gross 289fe36d37 Print thread ID in panic message if thread name is unknown
`panic!` does not print any identifying information for threads that are
unnamed. However, in many cases, the thread ID can be determined.

This changes the panic message from something like this:

    thread '<unnamed>' panicked at src/main.rs:3:5:
    explicit panic

To something like this:

    thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5:
    explicit panic

Stack overflow messages are updated as well.

This change applies to both named and unnamed threads. The ID printed is
the OS integer thread ID rather than the Rust thread ID, which should
also be what debuggers print.
2025-08-06 23:59:47 +00:00
Paul Menage 9e5c942286 Mark some std tests as requiring panic = "unwind"
This allows these test modules to pass on builds/targets without
unwinding support, where `panic = "abort"` - the ignored tests are for
functionality that's not supported on those targets.
2025-03-10 08:31:06 -07:00
Thalia Archibald 988eb19970 library: Use size_of from the prelude instead of imported
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the
prelude instead of importing or qualifying them.

These functions were added to all preludes in Rust 1.80.
2025-03-06 20:20:38 -08:00
Michael Goulet c682aa162b Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
Nicholas Nethercote 84ac80f192 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Mads Marquart d9c0eb8084 Use target_vendor = "apple" instead of target_os = "..." 2024-04-28 18:22:37 +02:00
Guillaume Gomez 1bffe75df6 Rollup merge of #123505 - ChrisDenton:revert-121666, r=workingjubilee
Revert "Use OS thread name by default"

This reverts #121666 (Use the OS thread name by default if `THREAD_INFO` has not been initialized) due to #123495 (Thread names are not always valid UTF-8).

It's not a direct revert because there have been other changes since that PR.
2024-04-05 22:33:28 +02:00
Chris Denton 7d008267dd Revert #121666
This reverts #121666 due to #123495
2024-04-05 12:50:31 +00:00
Adam Gastineau 4f6f433745 Support for visionOS 2024-03-18 20:45:45 -07:00
bors aa029ce4d8 Auto merge of #122113 - matthiaskrgr:rollup-5d1jnwi, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #121958 (Fix redundant import errors for preload extern crate)
 - #121976 (Add an option to have an external download/bootstrap cache)
 - #122022 (loongarch: add frecipe and relax target feature)
 - #122026 (Do not try to format removed files)
 - #122027 (Uplift some feeding out of `associated_type_for_impl_trait_in_impl` and into queries)
 - #122063 (Make the lowering of `thir::ExprKind::If` easier to follow)
 - #122074 (Add missing PartialOrd trait implementation doc for array)
 - #122082 (remove outdated fixme comment)
 - #122091 (Note why we're using a new thread in `test_get_os_named_thread`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-07 02:30:40 +00:00
Chris Denton 8718317725 Document and test minimal stack size on Windows 2024-03-06 19:54:09 +00:00
Chris Denton 99577368cf Note why we're using a new thread in a test 2024-03-06 15:42:48 +00:00
roblabla 9eb927e025 Don't run test_get_os_named_thread on win7
This test won't work on windows 7, as the Thread::set_name function is
not implemented there (win7 does not provide a documented mechanism to
set thread names).
2024-03-04 09:24:41 +01:00
Chris Denton c84ba23062 Test getting the OS thread name 2024-02-27 11:28:17 -03:00
Thom Chiovoloni 37854aab76 Update tvOS support elsewhere in the stdlib 2023-06-21 14:59:40 -07:00
Urgau d36e390d81 Remove and fix useless drop of reference 2023-05-10 19:36:01 +02:00
Josh Stone 15cfeb33b0 Only test pthread_getname_np on linux-gnu 2022-10-23 11:53:39 -07:00
Josh Stone 12e45846eb Move truncation next to other thread tests for tidy 2022-10-21 18:13:22 -07:00
joboet 0ad4dd494a std: add thread parking tests 2022-10-06 22:46:47 +02:00
Ralf Jung 27b0444333 add some Miri-only tests 2022-08-18 18:07:39 -04:00
Frank Steffahn eb14dd863a Test NLL fix of bad lifetime inference for reference captured in closure. 2022-06-15 11:54:59 +02:00
est31 d75c60f9a3 Use Box::new() instead of box syntax in std tests 2022-05-29 01:44:11 +02:00
Mara Bos b97d87518d Add soundness test for dropping scoped thread results before joining. 2022-03-09 11:47:53 +01:00
Mara Bos 1c06eb7c1f Remove outdated comment. 2022-03-09 11:47:46 +01:00
Mara Bos c021ac35fa Update test. 2022-03-03 12:09:18 +01:00
Lucas Kent b656384d83 Update stdlib to the 2021 edition 2021-12-18 00:21:53 +11:00
Mara Bos 67362b301b Add test for JoinHandle::is_running. 2021-10-31 15:23:36 +01:00
Lzu Tao a4e926daee std: move "mod tests/benches" to separate files
Also doing fmt inplace as requested.
2020-08-31 02:56:59 +00:00