Skip to content

Rollup of 10 pull requests #136943

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 30 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5932b2f
tests/assembly: make windows ABI test cross-compile
workingjubilee Feb 9, 2025
b3464fa
tests/assembly: make typed-swap test much less fragile
workingjubilee Feb 9, 2025
ee111b2
tests/assembly: use -Copt-level=3 instead of -O
workingjubilee Feb 9, 2025
833f070
tests/assembly: cross-compile x86-return-float
workingjubilee Feb 9, 2025
3580698
tests: issue-122805 -> dont-shuffle-bswaps
workingjubilee Feb 10, 2025
95357c7
Check whole Unsize predicate for escaping bound vars
compiler-errors Feb 10, 2025
8a0a4df
Add docs to bootstrap:src:utils:cache
Shourya742 Feb 11, 2025
24150eb
add unit test to bootstrap:util:cache:tests
Shourya742 Feb 11, 2025
7972aa2
dev-guide: Link to t-lang procedures for new features
madsmtm Feb 11, 2025
4c17270
tests: simplify dont-shuffle-bswaps test
workingjubilee Feb 10, 2025
3c0c9b6
tests/codegen: use -Copt-level=3 instead of -O
workingjubilee Feb 9, 2025
d9c7abb
compiler: narrow scope of nightly cfg in rustc_abi
workingjubilee Feb 10, 2025
038c183
compiler: remove rustc_target reexport of rustc_abi::HashStableContext
workingjubilee Feb 10, 2025
8abff35
compiler: compare and hash ExternAbi like its string
workingjubilee Feb 10, 2025
edff4fe
compiler: remove AbiDatas
workingjubilee Feb 11, 2025
f8570e8
compiler: remove rustc_abi::lookup and AbiUnsupported
workingjubilee Feb 11, 2025
7564f3c
compiler: Make middle errors `pub(crate)` and bury some dead code
workingjubilee Feb 12, 2025
8a70219
use cc archiver as default in `cc2ar`
onur-ozkan Feb 12, 2025
d99d8c2
Nuke `Buffer` abstraction from `librustdoc` 💣
yotamofek Feb 9, 2025
21bb8cb
Change swap_nonoverlapping from lang to library UB
saethlin Feb 11, 2025
a3f76ad
Rollup merge of #136758 - workingjubilee:specify-opt-level-for-tests,…
GuillaumeGomez Feb 12, 2025
f0af030
Rollup merge of #136761 - workingjubilee:specify-opt-level-for-codege…
GuillaumeGomez Feb 12, 2025
10b5596
Rollup merge of #136784 - yotamofek:pr/rustdoc-remove-buffer-take2, r…
GuillaumeGomez Feb 12, 2025
993eb34
Rollup merge of #136838 - compiler-errors:escaping-unsize, r=fmease
GuillaumeGomez Feb 12, 2025
2494905
Rollup merge of #136848 - Shourya742:2025-02-11-add-docs-and-ut-for-u…
GuillaumeGomez Feb 12, 2025
428baf5
Rollup merge of #136871 - madsmtm:link-to-lang-procedures, r=scottmcm
GuillaumeGomez Feb 12, 2025
269d784
Rollup merge of #136890 - saethlin:swap_nonoverlapping, r=RalfJung
GuillaumeGomez Feb 12, 2025
27dc222
Rollup merge of #136901 - workingjubilee:stabilize-externabi-hashing-…
GuillaumeGomez Feb 12, 2025
54b4b1c
Rollup merge of #136907 - workingjubilee:middle-errors-cleanup, r=com…
GuillaumeGomez Feb 12, 2025
8567fbb
Rollup merge of #136916 - onur-ozkan:fix-cc2ar, r=jieyouxu
GuillaumeGomez Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change swap_nonoverlapping from lang to library UB
  • Loading branch information
saethlin committed Feb 12, 2025
commit 21bb8cb946fbdbcd0b22f12d1c0d2091f2a7fb2f
2 changes: 1 addition & 1 deletion library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ pub const unsafe fn swap<T>(x: *mut T, y: *mut T) {
#[rustc_diagnostic_item = "ptr_swap_nonoverlapping"]
pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
ub_checks::assert_unsafe_precondition!(
check_language_ub,
check_library_ub,
"ptr::swap_nonoverlapping requires that both pointer arguments are aligned and non-null \
and the specified memory ranges do not overlap",
(
Expand Down
15 changes: 15 additions & 0 deletions src/tools/miri/tests/fail/ptr_swap_nonoverlapping.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! This is a regression test for <https://github.com/rust-lang/miri/issues/4188>: The precondition
//! check in `ptr::swap_nonoverlapping` was incorrectly disabled in Miri.
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
//@normalize-stderr-test: "\| +\^+" -> "| ^"
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
//@normalize-stderr-test: "\n +at [^\n]+" -> ""
//@error-in-other-file: aborted execution

fn main() {
let mut data = 0usize;
let ptr = std::ptr::addr_of_mut!(data);
unsafe {
std::ptr::swap_nonoverlapping(ptr, ptr, 1);
}
}
31 changes: 31 additions & 0 deletions src/tools/miri/tests/fail/ptr_swap_nonoverlapping.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
unsafe precondition(s) violated: ptr::swap_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
thread caused non-unwinding panic. aborting.
error: abnormal termination: the program aborted execution
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
|
LL | ABORT();
| ^ the program aborted execution
|
= note: BACKTRACE:
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
= note: inside `std::ptr::swap_nonoverlapping::precondition_check` at RUSTLIB/core/src/ub_checks.rs:LL:CC
= note: inside `std::ptr::swap_nonoverlapping::<usize>` at RUSTLIB/core/src/ub_checks.rs:LL:CC
note: inside `main`
--> tests/fail/ptr_swap_nonoverlapping.rs:LL:CC
|
LL | std::ptr::swap_nonoverlapping(ptr, ptr, 1);
| ^

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error

Loading