Skip to content

Rollup of 8 pull requests #140360

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

Merged
merged 19 commits into from
Apr 27, 2025
Merged

Rollup of 8 pull requests #140360

merged 19 commits into from
Apr 27, 2025

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

clarfonthey and others added 19 commits February 22, 2025 14:59
It wants an owned path, so pass an owned path
They are no longer necessary after rust-lang#139281
Inline some functions used once.
Use `impl Trait` more.
Tweak some comments.
Stabilise `std::ffi::c_str`

This finished FCP in rust-lang#112134 but never actually got a stabilisation PR. Since the FCP in rust-lang#120048 recently passed to add the `os_str` module, it would be nice to also merge this too, to ensure that both get added in the next version.

Note: The added stability attributes which *somehow* were able to be omitted before (rustc bug?) were added based on the fact that they were added in 3025513, which ended up in 1.85.0.

Closes: rust-lang#112134

r? libs-api
Update safety documentation for `CString::from_ptr` and `str::from_boxed_utf8_unchecked`

## PR Description​
This PR addresses missing safety documentation for two APIs:

​**1. alloc::ffi::CStr::from_raw**​

- ​`Alias`: The pointer ​must not be aliased​ (accessed via other pointers) during the reconstructed CString's lifetime.
- `Owning`: Calling this function twice on the same pointer and creating two objects with overlapping lifetimes, introduces two alive owners of the same memory. This may result in a double-free.
- `Dangling`: The prior documentation required the pointer to originate from CString::into_raw, but this constraint is incomplete. A validly sourced pointer can also cause undefined behavior (UB) if it becomes dangling. A simple Poc for this situation:
```
use std::ffi::CString;
use std::os::raw::c_char;

fn create_dangling() -> *mut c_char {
    let local_ptr: *mut c_char = {
        let valid_data = CString::new("valid").unwrap();
        valid_data.into_raw()
    };

    unsafe {
        let _x = CString::from_raw(local_ptr);
    }
    local_ptr
}

fn main() {
    let dangling = create_dangling();
    unsafe {let _y = CString::from_raw(dangling);} // Cause UB!
}
```

​**2. alloc::str::from_boxed_utf8_unchecked**​

- `ValidStr`: Bytes must contain a ​valid UTF-8 sequence.
…ss35

Use char::is_whitespace directly in str::trim*

Use the method directly instead of wrapping it in a closure.
…, r=tgross35

fix docs for `Peekable::next_if{_eq}`

These seem like copy-paste errors

(except `saves the value of` 👉 `retains` which just sounds better to me)
Update example to use CStr::to_string_lossy
Clarified bootstrap optimization "true" argument

fixes rust-lang#140328
session: Cleanup `CanonicalizedPath::new`

It wants an owned path, so pass an owned path.
…errors

rustc_span: Some hygiene cleanups

Mostly enabled by rust-lang#139241 and rust-lang#139281.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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 Apr 27, 2025
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Apr 27, 2025

📌 Commit aa5c6d4 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors 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 Apr 27, 2025
@bors
Copy link
Collaborator

bors commented Apr 27, 2025

⌛ Testing commit aa5c6d4 with merge 267cae5...

@bors
Copy link
Collaborator

bors commented Apr 27, 2025

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 267cae5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 27, 2025
@bors bors merged commit 267cae5 into rust-lang:master Apr 27, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 27, 2025
Copy link

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 8947e16 (parent) -> 267cae5 (this PR)

Test differences

Show 33174 test diffs

Stage 1

  • error_reporting::traits::on_unimplemented::verify_trait_selection_wrapped_parser_error_3: [missing] -> pass (J0)
  • errors::verify_codegen_ssa_error_creating_remark_dir_134: [missing] -> pass (J0)
  • errors::verify_codegen_ssa_forbidden_target_feature_attr_129: [missing] -> pass (J0)
  • errors::verify_resolve_anonymous_lifetime_non_gat_report_error_47: [missing] -> pass (J0)
  • html::render::sorted_template::tests::js_empty_array: [missing] -> pass (J0)
  • lints::verify_lint_unnecessary_qualification_145: [missing] -> pass (J0)
  • maybe_transmutable::tests::safety::src_unsafe_dst_unsafe: [missing] -> pass (J0)
  • spec::tests::aarch64_unknown_nto_qnx710_iosock: [missing] -> pass (J0)
  • spec::tests::bpfeb_unknown_none: [missing] -> pass (J0)
  • spec::tests::csky_unknown_linux_gnuabiv2hf: [missing] -> pass (J0)
  • spec::tests::loongarch64_unknown_linux_ohos: [missing] -> pass (J0)
  • spec::tests::msp430_none_elf: [missing] -> pass (J0)
  • spec::tests::riscv32im_unknown_none_elf: [missing] -> pass (J0)
  • spec::tests::thumbv8m_main_nuttx_eabi: [missing] -> pass (J0)
  • spec::tests::wasm32_unknown_emscripten: [missing] -> pass (J0)
  • tests::test_normalize_newlines: [missing] -> pass (J0)
  • cell::cell_set: [missing] -> pass (J1)
  • char::test_escape_default: [missing] -> pass (J1)
  • collections::btree::map::tests::test_append_14: [missing] -> pass (J1)
  • collections::btree::map::tests::test_extract_if::height_2_removing_all: [missing] -> pass (J1)
  • collections::btree::map::tests::test_range_equal_empty_cases: [missing] -> pass (J1)
  • f32::test_exp: [missing] -> pass (J1)
  • io::buffered::tests::test_buffered_writer: [missing] -> pass (J1)
  • iter::adapters::flat_map::test_flat_map_try_folds: [missing] -> pass (J1)
  • mpsc_sync::oneshot_single_thread_try_send_closed: [missing] -> pass (J1)
  • net::socket_addr::ipv4_socket_addr_to_string: [missing] -> pass (J1)
  • num::bignum::test_div_rem: [missing] -> pass (J1)
  • num::test_try_u64i32: [missing] -> pass (J1)
  • num::u64::test_bitwise_operators: [missing] -> pass (J1)
  • raw_vec::tests::zst_reserve_panic: [missing] -> pass (J1)
  • rwlock::test_rw_arc_no_poison_mapped_r_w: [missing] -> pass (J1)
  • slice::test_get_disjoint_mut_single_first: [missing] -> pass (J1)
  • slice::test_in_place_iterator_specialization: [missing] -> pass (J1)
  • slice::test_rchunks_exact_nth_back: [missing] -> pass (J1)
  • slice::test_slice_2: [missing] -> pass (J1)
  • str::test_join_for_different_lengths_with_long_separator: [missing] -> pass (J1)
  • sync::test_live: [missing] -> pass (J1)
  • thread::tests::test_thread_id_equal: [missing] -> pass (J1)
  • vec::test_drain_end_overflow: [missing] -> pass (J1)
  • ascii::is_ascii::unaligned_head_long::case00_libcore: [missing] -> pass (J2)
  • fmt::write_vec_ref: [missing] -> pass (J2)
  • iter::bench_cycle_take_sum: [missing] -> pass (J2)
  • net::socket_addr::tests::to_socket_addr_string: [missing] -> pass (J2)
  • net::udp::tests::udp_clone_two_read: [missing] -> pass (J2)
  • sort::tests::stable::correct_cell_i32_ascending: [missing] -> pass (J2)
  • sort::tests::stable::panic_retain_orig_set_cell_i32_random_d2: [missing] -> pass (J2)
  • sort::tests::stable::violate_ord_retain_orig_set_cell_i32_random: [missing] -> pass (J2)
  • sort::tests::unstable::violate_ord_retain_orig_set_cell_i32_ascending: [missing] -> pass (J2)
  • str::char_count::emoji_tiny::case01_filter_count_cont_bytes: [missing] -> pass (J2)
  • str::chars_count::long_lorem_ipsum: [missing] -> pass (J2)
  • vec::bench_extend_0000_1000: [missing] -> pass (J2)
  • sort::tests::unstable::panic_retain_orig_set_i32_saw_mixed: [missing] -> ignore (J4)

Stage 2

  • back::apple::tests::try_lookup_invalid_sdk: pass -> [missing] (J0)
  • errors::verify_codegen_ssa_shuffle_indices_evaluation_84: pass -> [missing] (J0)
  • errors::verify_const_eval_non_const_try_block_from_output_30: pass -> [missing] (J0)
  • errors::verify_const_eval_panic_non_str_7: pass -> [missing] (J0)
  • errors::verify_interface_error_writing_dependencies_6: pass -> [missing] (J0)
  • errors::verify_mir_dataflow_peek_argument_untracked_9: pass -> [missing] (J0)
  • errors::verify_parse_bad_return_type_notation_output_130: pass -> [missing] (J0)
  • errors::verify_passes_layout_abi_115: pass -> [missing] (J0)
  • errors::verify_passes_unstable_attr_for_already_stable_feature_154: pass -> [missing] (J0)
  • session_diagnostics::verify_driver_impl_rlink_no_a_file_6: pass -> [missing] (J0)
  • spec::tests::amdgcn_amd_amdhsa: pass -> [missing] (J0)
  • spec::tests::armv7_sony_vita_newlibeabihf: pass -> [missing] (J0)
  • spec::tests::armv7a_nuttx_eabihf: pass -> [missing] (J0)
  • spec::tests::thumbv7neon_unknown_linux_gnueabihf: pass -> [missing] (J0)
  • spec::tests::x86_64_pc_solaris: pass -> [missing] (J0)
  • symbols::tests::check_dup_keywords: pass -> [missing] (J0)
  • sys::process::unix::common::tests::test_process_group_posix_spawn: ignore -> [missing] (J0)
  • transitive_relation::tests::mubs_no_best_choice: pass -> [missing] (J0)
  • arc::slice: pass -> [missing] (J1)
  • array::array_try_from_fn_drops_inserted_elements_on_panic: pass -> [missing] (J1)
  • cmp::test_ord_max_min: pass -> [missing] (J1)
  • fmt::test_pointer_formats_data_pointer: pass -> [missing] (J1)
  • misc_tests::any_move: pass -> [missing] (J1)
  • mpsc::smoke_shared_port_gone2: pass -> [missing] (J1)
  • num::i64::test_count_zeros: pass -> [missing] (J1)
  • num::test_try_i64isize: pass -> [missing] (J1)
  • num::test_try_u16isize: pass -> [missing] (J1)
  • num::test_try_u64i128: pass -> [missing] (J1)
  • num::u8::test_carrying_add: pass -> [missing] (J1)
  • pin::pin_const: pass -> [missing] (J1)
  • slice::test_chunks_next: pass -> [missing] (J1)
  • slice::test_split_iterator_mut_inclusive: pass -> [missing] (J1)
  • sort::tests::unstable::correct_i32_random_z1: pass -> [missing] (J1)
  • string::test_from_str: pass -> [missing] (J1)
  • time::new_overflow: pass -> [missing] (J1)
  • vec::test_extend_ref: pass -> [missing] (J1)
  • vec::test_partition: pass -> [missing] (J1)
  • hash::set_ops::set_symmetric_difference: pass -> [missing] (J2)
  • sort::tests::unstable::stability_cell_i32_random_s95: pass -> [missing] (J2)
  • str::bench_contains_bad_simd: pass -> [missing] (J2)
  • str::ends_with_ascii_char::short_mixed: pass -> [missing] (J2)
  • str::splitn_space_char::short_mixed: pass -> [missing] (J2)
  • vec::bench_extend_from_slice_0010_0010: pass -> [missing] (J2)
  • vec::bench_from_elem_0100: pass -> [missing] (J2)
  • vec_deque::bench_mut_iter_1000: pass -> [missing] (J2)
  • os::unix::net::tests::test_send_vectored_with_ancillary_to_unix_datagram: pass -> [missing] (J3)
  • sort::tests::stable::panic_retain_orig_set_i32_random_d20: ignore -> [missing] (J4)
  • sort::tests::unstable::panic_retain_orig_set_i32_random_d2: ignore -> [missing] (J4)

(and 16450 additional test diffs)

Additionally, 16624 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 267cae5bdbd602dd13f3851b9c96ce93697e59a0 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-apple-2: 1675.4s -> 4617.9s (175.6%)
  2. test-various: 2401.9s -> 4192.4s (74.5%)
  3. x86_64-apple-1: 5498.7s -> 7709.5s (40.2%)
  4. x86_64-gnu-aux: 4344.2s -> 5950.6s (37.0%)
  5. aarch64-apple: 3111.3s -> 4045.2s (30.0%)
  6. dist-apple-various: 7828.5s -> 7236.7s (-7.6%)
  7. dist-x86_64-illumos: 5620.7s -> 6004.3s (6.8%)
  8. dist-aarch64-apple: 5014.3s -> 4680.5s (-6.7%)
  9. i686-msvc-1: 9650.7s -> 9145.1s (-5.2%)
  10. dist-ohos: 10263.2s -> 10712.5s (4.4%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#137439 Stabilise std::ffi::c_str 6fc31eb985b5d62a538e111d36296e6a6b1820a6 (link)
#137714 Update safety documentation for CString::from_ptr and `st… 8fc89be9bc84c384012d717f8a123a1b2c7d5168 (link)
#139031 Use char::is_whitespace directly in str::trim* e8729e3cce93b736e7bfb145b126c1d5197e406f (link)
#139090 fix docs for Peekable::next_if{_eq} 42fda03e3467f782caaccc1ebd30358b439d1e5a (link)
#140297 Update example to use CStr::to_string_lossy 35e04143f948f4842461a349052f118a0e296ceb (link)
#140330 Clarified bootstrap optimization "true" argument daaf9d6a1c7d730af6c1836ef47b7c4e1875ad53 (link)
#140339 session: Cleanup CanonicalizedPath::new e383af461c5883fc3fdafaa3d3ad3ce807cad13c (link)
#140346 rustc_span: Some hygiene cleanups 6c1c3bfc2ad48a69c31004acee9778e8a456503f (link)

previous master: 8947e167e5

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (267cae5): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary 1.2%, secondary 2.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.6% [0.8%, 8.1%] 5
Regressions ❌
(secondary)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
-2.7% [-7.0%, -0.6%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.2% [-7.0%, 8.1%] 8

Cycles

Results (primary 0.6%, secondary 3.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.5%, 0.7%] 3
Regressions ❌
(secondary)
3.0% [3.0%, 3.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [0.5%, 0.7%] 3

Binary size

Results (primary -0.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.2%, -0.0%] 9
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.2%, -0.0%] 9

Bootstrap: 763.457s -> 762.088s (-0.18%)
Artifact size: 365.17 MiB -> 365.14 MiB (-0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.