-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rollup of 7 pull requests #122176
Closed
Closed
Rollup of 7 pull requests #122176
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Mara Bos <[email protected]>
Co-authored-by: Mara Bos <[email protected]>
This makes more sense because most cases then second one is unwind target.
Some implementations of `Write::write_vectored` in the standard library (`BufWriter`, `LineWriter`, `Stdout`, `Stderr`) check all buffers to calculate the total length. This is O(n) over the number of buffers. It's common that only a limited number of buffers is written at a time (e.g. 1024 for `writev(2)`). `write_vectored_all` will then call `write_vectored` repeatedly, leading to a runtime of O(n²) over the number of buffers. The fix is to only calculate as much as needed if it's needed.
…ute to inner type.
@rustbot label: +llvm-main
Improve std::fs::read_to_string example Resolves [rust-lang#118621](rust-lang#118621) For the original code to succeed it requires address.txt to contain a socketaddress, however it is much easier to follow if this is just any strong - eg address could be a street address or just text. Also changed the variable name from "foo" to something more meaningful as cargo clippy warns you against using foo as a placeholder. ``` $ cat main.rs use std::fs; use std::error::Error; fn main() -> Result<(), Box<dyn Error>> { let addr: String = fs::read_to_string("address.txt")?.parse()?; println!("{}", addr); Ok(()) } $ cat address.txt 123 rusty lane san francisco 94999 $ cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.00s Running `/home/haydon/workspace/rust-test-pr/tester/target/debug/tester` 123 rusty lane san francisco 94999 ```
Add asm goto support to `asm!` Tracking issue: rust-lang#119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? `@Amanieu` cc `@ojeda`
Docs for std::ptr::slice_from_raw_parts
…, r=oli-obk Move generic `NonZero` `rustc_layout_scalar_valid_range_start` attribute to inner type. Tracking issue: rust-lang#120257 r? `@dtolnay`
…r=Amanieu Fix quadratic behavior of repeated vectored writes Some implementations of `Write::write_vectored` in the standard library (`BufWriter`, `LineWriter`, `Stdout`, `Stderr`) check all buffers to calculate the total length. This is O(n) over the number of buffers. It's common that only a limited number of buffers is written at a time (e.g. 1024 for `writev(2)`). `write_vectored_all` will then call `write_vectored` repeatedly, leading to a runtime of O(n²) over the number of buffers. This fix is to only calculate as much as needed if it's needed. Here's a test program: ```rust #![feature(write_all_vectored)] use std::fs::File; use std::io::{BufWriter, IoSlice, Write}; use std::time::Instant; fn main() { let buf = vec![b'\0'; 100_000_000]; let mut slices: Vec<IoSlice<'_>> = buf.chunks(100).map(IoSlice::new).collect(); let mut writer = BufWriter::new(File::create("/dev/null").unwrap()); let start = Instant::now(); write_smart(&slices, &mut writer); println!("write_smart(): {:?}", start.elapsed()); let start = Instant::now(); writer.write_all_vectored(&mut slices).unwrap(); println!("write_all_vectored(): {:?}", start.elapsed()); } fn write_smart(mut slices: &[IoSlice<'_>], writer: &mut impl Write) { while !slices.is_empty() { // Only try to write as many slices as can be written let res = writer .write_vectored(slices.get(..1024).unwrap_or(slices)) .unwrap(); slices = &slices[(res / 100)..]; } } ``` Before this change: ``` write_smart(): 6.666952ms write_all_vectored(): 498.437092ms ``` After this change: ``` write_smart(): 6.377158ms write_all_vectored(): 6.923412ms ``` `LineWriter` (and by extension `Stdout`) isn't fully repaired by this because it looks for newlines. I could open an issue for that after this is merged, I think it's fixable but not trivially.
Add `#[inline]` to `BTreeMap::new` constructor This PR add the `#[inline]` attribute to `BTreeMap::new` constructor as to make it eligible for inlining. <details> For some context: I was profiling `rustc --check-cfg` with callgrind and due to the way we currently setup all the targets and we end-up calling `BTreeMap::new` multiple times for (nearly) all the targets. Adding the `#[inline]` attribute reduced the number of instructions needed. </details>
…s, r=workingjubilee PassWrapper: update for llvm/llvm-project@a3319371970b `@rustbot` label: +llvm-main
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
rollup
A PR which is a rollup
labels
Mar 8, 2024
@bors r+ rollup=never p=8 |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Mar 8, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 8, 2024
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#118623 (Improve std::fs::read_to_string example) - rust-lang#119365 (Add asm goto support to `asm!`) - rust-lang#120608 (Docs for std::ptr::slice_from_raw_parts) - rust-lang#121885 (Move generic `NonZero` `rustc_layout_scalar_valid_range_start` attribute to inner type.) - rust-lang#121938 (Fix quadratic behavior of repeated vectored writes) - rust-lang#122099 (Add `#[inline]` to `BTreeMap::new` constructor) - rust-lang#122143 (PassWrapper: update for llvm/llvm-project@a3319371970b) Failed merges: - rust-lang#122076 (Tweak the way we protect in-place function arguments in interpreters) r? `@ghost` `@rustbot` modify labels: rollup
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
bors
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Mar 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
rollup
A PR which is a rollup
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Successful merges:
asm!
#119365 (Add asm goto support toasm!
)NonZero
rustc_layout_scalar_valid_range_start
attribute to inner type. #121885 (Move genericNonZero
rustc_layout_scalar_valid_range_start
attribute to inner type.)#[inline]
toBTreeMap::new
constructor #122099 (Add#[inline]
toBTreeMap::new
constructor)Failed merges:
r? @ghost
@rustbot modify labels: rollup
Create a similar rollup