Skip to content

Commit 4997a6f

Browse files
committed
Auto merge of rust-lang#120624 - matthiaskrgr:rollup-3gvcl20, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#120484 (Avoid ICE when is_val_statically_known is not of a supported type) - rust-lang#120516 (pattern_analysis: cleanup manual impls) - rust-lang#120517 (never patterns: It is correct to lower `!` to `_`.) - rust-lang#120523 (Improve `io::Read::read_buf_exact` error case) - rust-lang#120528 (Store SHOULD_CAPTURE as AtomicU8) - rust-lang#120529 (Update data layouts in custom target tests for LLVM 18) - rust-lang#120531 (Remove a bunch of `has_errors` checks that have no meaningful or the wrong effect) - rust-lang#120533 (Correct paths for hexagon-unknown-none-elf platform doc) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3475147 + 14f6ef0 commit 4997a6f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

std/src/io/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,10 @@ pub trait Read {
994994
}
995995

996996
if cursor.written() == prev_written {
997-
return Err(Error::new(ErrorKind::UnexpectedEof, "failed to fill buffer"));
997+
return Err(error::const_io_error!(
998+
ErrorKind::UnexpectedEof,
999+
"failed to fill whole buffer"
1000+
));
9981001
}
9991002
}
10001003

std/src/panic.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use crate::any::Any;
66
use crate::collections;
77
use crate::panicking;
8-
use crate::sync::atomic::{AtomicUsize, Ordering};
8+
use crate::sync::atomic::{AtomicU8, Ordering};
99
use crate::sync::{Mutex, RwLock};
1010
use crate::thread::Result;
1111

@@ -228,15 +228,15 @@ impl BacktraceStyle {
228228
if cfg!(feature = "backtrace") { Some(BacktraceStyle::Full) } else { None }
229229
}
230230

231-
fn as_usize(self) -> usize {
231+
fn as_u8(self) -> u8 {
232232
match self {
233233
BacktraceStyle::Short => 1,
234234
BacktraceStyle::Full => 2,
235235
BacktraceStyle::Off => 3,
236236
}
237237
}
238238

239-
fn from_usize(s: usize) -> Option<Self> {
239+
fn from_u8(s: u8) -> Option<Self> {
240240
Some(match s {
241241
0 => return None,
242242
1 => BacktraceStyle::Short,
@@ -251,7 +251,7 @@ impl BacktraceStyle {
251251
// that backtrace.
252252
//
253253
// Internally stores equivalent of an Option<BacktraceStyle>.
254-
static SHOULD_CAPTURE: AtomicUsize = AtomicUsize::new(0);
254+
static SHOULD_CAPTURE: AtomicU8 = AtomicU8::new(0);
255255

256256
/// Configure whether the default panic hook will capture and display a
257257
/// backtrace.
@@ -264,7 +264,7 @@ pub fn set_backtrace_style(style: BacktraceStyle) {
264264
// If the `backtrace` feature of this crate isn't enabled, skip setting.
265265
return;
266266
}
267-
SHOULD_CAPTURE.store(style.as_usize(), Ordering::Release);
267+
SHOULD_CAPTURE.store(style.as_u8(), Ordering::Release);
268268
}
269269

270270
/// Checks whether the standard library's panic hook will capture and print a
@@ -296,7 +296,7 @@ pub fn get_backtrace_style() -> Option<BacktraceStyle> {
296296
// to optimize away callers.
297297
return None;
298298
}
299-
if let Some(style) = BacktraceStyle::from_usize(SHOULD_CAPTURE.load(Ordering::Acquire)) {
299+
if let Some(style) = BacktraceStyle::from_u8(SHOULD_CAPTURE.load(Ordering::Acquire)) {
300300
return Some(style);
301301
}
302302

0 commit comments

Comments
 (0)