mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Rollup merge of #94756 - ChrisDenton:unreachable, r=yaahc
Use `unreachable!` for an unreachable code path Closes #73212
This commit is contained in:
@@ -224,8 +224,14 @@ fn fill_utf16_buf<F1, F2, T>(mut f1: F1, f2: F2) -> crate::io::Result<T>
|
||||
} as usize;
|
||||
if k == n && c::GetLastError() == c::ERROR_INSUFFICIENT_BUFFER {
|
||||
n *= 2;
|
||||
} else if k >= n {
|
||||
} else if k > n {
|
||||
n = k;
|
||||
} else if k == n {
|
||||
// It is impossible to reach this point.
|
||||
// On success, k is the returned string length excluding the null.
|
||||
// On failure, k is the required buffer length including the null.
|
||||
// Therefore k never equals n.
|
||||
unreachable!();
|
||||
} else {
|
||||
return Ok(f2(&buf[..k]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user