mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #130710 - GuillaumeGomez:rollup-mfuha68, r=GuillaumeGomez
Rollup of 5 pull requests Successful merges: - #130658 (Fix docs of compare_bytes) - #130670 (delay uncapping the max_read_size in File::read_to_end) - #130690 (interpret: remove outdated FIXME) - #130692 (make unstable Result::flatten a const fn) - #130702 (Add some missing unstable book tracking issue links) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
6c6d210089
@ -221,7 +221,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to exact equality.
|
// Fall back to exact equality.
|
||||||
// FIXME: We are missing the rules for "repr(C) wrapping compatible types".
|
|
||||||
Ok(caller == callee)
|
Ok(caller == callee)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2733,7 +2733,7 @@ extern "rust-intrinsic" {
|
|||||||
|
|
||||||
/// Lexicographically compare `[left, left + bytes)` and `[right, right + bytes)`
|
/// Lexicographically compare `[left, left + bytes)` and `[right, right + bytes)`
|
||||||
/// as unsigned bytes, returning negative if `left` is less, zero if all the
|
/// as unsigned bytes, returning negative if `left` is less, zero if all the
|
||||||
/// bytes match, or positive if `right` is greater.
|
/// bytes match, or positive if `left` is greater.
|
||||||
///
|
///
|
||||||
/// This underlies things like `<[u8]>::cmp`, and will usually lower to `memcmp`.
|
/// This underlies things like `<[u8]>::cmp`, and will usually lower to `memcmp`.
|
||||||
///
|
///
|
||||||
|
@ -2538,6 +2538,7 @@ impl<T> Option<Option<T>> {
|
|||||||
#[stable(feature = "option_flattening", since = "1.40.0")]
|
#[stable(feature = "option_flattening", since = "1.40.0")]
|
||||||
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
|
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
|
||||||
pub const fn flatten(self) -> Option<T> {
|
pub const fn flatten(self) -> Option<T> {
|
||||||
|
// FIXME(const-hack): could be written with `and_then`
|
||||||
match self {
|
match self {
|
||||||
Some(inner) => inner,
|
Some(inner) => inner,
|
||||||
None => None,
|
None => None,
|
||||||
|
@ -1676,8 +1676,13 @@ impl<T, E> Result<Result<T, E>, E> {
|
|||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "result_flattening", issue = "70142")]
|
#[unstable(feature = "result_flattening", issue = "70142")]
|
||||||
pub fn flatten(self) -> Result<T, E> {
|
#[rustc_const_unstable(feature = "result_flattening", issue = "70142")]
|
||||||
self.and_then(convert::identity)
|
pub const fn flatten(self) -> Result<T, E> {
|
||||||
|
// FIXME(const-hack): could be written with `and_then`
|
||||||
|
match self {
|
||||||
|
Ok(inner) => inner,
|
||||||
|
Err(e) => Err(e),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,8 +398,7 @@ where
|
|||||||
// - avoid passing large buffers to readers that always initialize the free capacity if they perform short reads (#23815, #23820)
|
// - avoid passing large buffers to readers that always initialize the free capacity if they perform short reads (#23815, #23820)
|
||||||
// - pass large buffers to readers that do not initialize the spare capacity. this can amortize per-call overheads
|
// - pass large buffers to readers that do not initialize the spare capacity. this can amortize per-call overheads
|
||||||
// - and finally pass not-too-small and not-too-large buffers to Windows read APIs because they manage to suffer from both problems
|
// - and finally pass not-too-small and not-too-large buffers to Windows read APIs because they manage to suffer from both problems
|
||||||
// at the same time, i.e. small reads suffer from syscall overhead, all reads incur initialization cost
|
// at the same time, i.e. small reads suffer from syscall overhead, all reads incur costs proportional to buffer size (#110650)
|
||||||
// proportional to buffer size (#110650)
|
|
||||||
//
|
//
|
||||||
pub(crate) fn default_read_to_end<R: Read + ?Sized>(
|
pub(crate) fn default_read_to_end<R: Read + ?Sized>(
|
||||||
r: &mut R,
|
r: &mut R,
|
||||||
@ -444,6 +443,8 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut consecutive_short_reads = 0;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if buf.len() == buf.capacity() && buf.capacity() == start_cap {
|
if buf.len() == buf.capacity() && buf.capacity() == start_cap {
|
||||||
// The buffer might be an exact fit. Let's read into a probe buffer
|
// The buffer might be an exact fit. Let's read into a probe buffer
|
||||||
@ -489,6 +490,12 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>(
|
|||||||
return Ok(buf.len() - start_len);
|
return Ok(buf.len() - start_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if bytes_read < buf_len {
|
||||||
|
consecutive_short_reads += 1;
|
||||||
|
} else {
|
||||||
|
consecutive_short_reads = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// store how much was initialized but not filled
|
// store how much was initialized but not filled
|
||||||
initialized = unfilled_but_initialized;
|
initialized = unfilled_but_initialized;
|
||||||
|
|
||||||
@ -503,7 +510,10 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>(
|
|||||||
// The reader is returning short reads but it doesn't call ensure_init().
|
// The reader is returning short reads but it doesn't call ensure_init().
|
||||||
// In that case we no longer need to restrict read sizes to avoid
|
// In that case we no longer need to restrict read sizes to avoid
|
||||||
// initialization costs.
|
// initialization costs.
|
||||||
if !was_fully_initialized {
|
// When reading from disk we usually don't get any short reads except at EOF.
|
||||||
|
// So we wait for at least 2 short reads before uncapping the read buffer;
|
||||||
|
// this helps with the Windows issue.
|
||||||
|
if !was_fully_initialized && consecutive_short_reads > 1 {
|
||||||
max_read_size = usize::MAX;
|
max_read_size = usize::MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# `branch-protection`
|
# `branch-protection`
|
||||||
|
|
||||||
|
The tracking issue for this feature is: [#113369](https://github.com/rust-lang/rust/issues/113369).
|
||||||
|
|
||||||
|
------------------------
|
||||||
|
|
||||||
This option lets you enable branch authentication instructions on AArch64.
|
This option lets you enable branch authentication instructions on AArch64.
|
||||||
This option is only accepted when targeting AArch64 architectures.
|
This option is only accepted when targeting AArch64 architectures.
|
||||||
It takes some combination of the following values, separated by a `,`.
|
It takes some combination of the following values, separated by a `,`.
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
The `more_qualified_paths` feature can be used in order to enable the
|
The `more_qualified_paths` feature can be used in order to enable the
|
||||||
use of qualified paths in patterns.
|
use of qualified paths in patterns.
|
||||||
|
|
||||||
|
The tracking issue for this feature is: [#86935](https://github.com/rust-lang/rust/issues/86935).
|
||||||
|
|
||||||
|
------------------------
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
`postfix-match` adds the feature for matching upon values postfix
|
`postfix-match` adds the feature for matching upon values postfix
|
||||||
the expressions that generate the values.
|
the expressions that generate the values.
|
||||||
|
|
||||||
|
The tracking issue for this feature is: [#121618](https://github.com/rust-lang/rust/issues/121618).
|
||||||
|
|
||||||
|
------------------------
|
||||||
|
|
||||||
```rust,edition2021
|
```rust,edition2021
|
||||||
#![feature(postfix_match)]
|
#![feature(postfix_match)]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user