mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 05:57:03 +03:00
Improve Debug formatting of the thread name.
This commit is contained in:
+2
-6
@@ -132,13 +132,9 @@ fn check_terminated(&mut self) -> bool {
|
||||
impl<'mir, 'tcx> std::fmt::Debug for Thread<'mir, 'tcx> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
if let Some(ref name) = self.thread_name {
|
||||
if let Ok(name_str) = std::str::from_utf8(name) {
|
||||
write!(f, "{}", name_str)?;
|
||||
} else {
|
||||
write!(f, "<invalid thread name>")?;
|
||||
}
|
||||
write!(f, "{}", String::from_utf8_lossy(name))?;
|
||||
} else {
|
||||
write!(f, "unnamed")?;
|
||||
write!(f, "<unnamed>")?;
|
||||
}
|
||||
write!(f, "({:?}, {:?})", self.state, self.join_status)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user