Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

unstably constify ptr::drop_in_place #145725

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

Closed

Conversation

Copy link
Contributor

@Qelxiros Qelxiros commented Aug 21, 2025
edited by rustbot
Loading

Tracking issue: #109342

Copy link
Collaborator

rustbot commented Aug 21, 2025

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 21, 2025
Copy link
Collaborator

The job x86_64-gnu-miri failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/fail/tree_borrows/reserved/int-protected-write.rs ... ok
tests/fail/tree_borrows/reserved/cell-protected-write.rs ... ok
FAILED TEST: tests/fail/stacked_borrows/drop_in_place_retag.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-fFvC7F" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/tmp/miri_ui/0/tests/fail/stacked_borrows" "tests/fail/stacked_borrows/drop_in_place_retag.rs" "--edition" "2021"
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/fail/stacked_borrows/drop_in_place_retag.stderr` to the actual output
--- tests/fail/stacked_borrows/drop_in_place_retag.stderr
+++ <stderr output>
 error: Undefined Behavior: trying to retag from <TAG> for Unique permission at ALLOC[0x0], but that tag only grants SharedReadOnly permission for this location
 --> RUSTLIB/core/src/ptr/mod.rs:LL:CC
 |
-LL | pub unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) {
+LL | pub const unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this error occurs as part of retag at ALLOC[0x0..0x1]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this error occurs as part of retag at ALLOC[0x0..0x1]
 |
 = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
... 17 lines skipped ...
 error: aborting due to 1 previous error
 
Full unnormalized output:
error: Undefined Behavior: trying to retag from <189> for Unique permission at alloc81[0x0], but that tag only grants SharedReadOnly permission for this location
##[error] --> /checkout/library/core/src/ptr/mod.rs:805:1
 |
LL | pub const unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) {
 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this error occurs as part of retag at alloc81[0x0..0x1]
 |
 = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
 = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <189> was created by a SharedReadOnly retag at offsets [0x0..0x1]
 --> tests/fail/stacked_borrows/drop_in_place_retag.rs:9:17
 |
LL | let x = core::ptr::addr_of!(x);
 | ^^^^^^^^^^^^^^^^^^^^^^
 = note: BACKTRACE (of the first span):
 = note: inside `std::ptr::drop_in_place::<u8> - shim(None)` at /checkout/library/core/src/ptr/mod.rs:805:1: 805:68
note: inside `main`
 --> tests/fail/stacked_borrows/drop_in_place_retag.rs:10:9
 |
LL | core::ptr::drop_in_place(x.cast_mut());
 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---
full stderr:
error: Undefined Behavior: trying to retag from <189> for Unique permission at alloc81[0x0], but that tag only grants SharedReadOnly permission for this location
##[error] --> /checkout/library/core/src/ptr/mod.rs:805:1
 |
LL | pub const unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) {
 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this error occurs as part of retag at alloc81[0x0..0x1]
 |
 = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
 = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <189> was created by a SharedReadOnly retag at offsets [0x0..0x1]
 --> tests/fail/stacked_borrows/drop_in_place_retag.rs:9:17
 |
LL | let x = core::ptr::addr_of!(x);
 | ^^^^^^^^^^^^^^^^^^^^^^
 = note: BACKTRACE (of the first span):
 = note: inside `std::ptr::drop_in_place::<u8> - shim(None)` at /checkout/library/core/src/ptr/mod.rs:805:1: 805:68
note: inside `main`
 --> tests/fail/stacked_borrows/drop_in_place_retag.rs:10:9
 |
LL | core::ptr::drop_in_place(x.cast_mut());
 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---
FAILED TEST: tests/fail/unaligned_pointers/drop_in_place.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-fFvC7F" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/tmp/miri_ui/0/tests/fail/unaligned_pointers" "tests/fail/unaligned_pointers/drop_in_place.rs" "-Cdebug-assertions=no" "--edition" "2021"
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/fail/unaligned_pointers/drop_in_place.stderr` to the actual output
--- tests/fail/unaligned_pointers/drop_in_place.stderr
+++ <stderr output>
 error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
 --> RUSTLIB/core/src/ptr/mod.rs:LL:CC
 |
-LL | pub unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) {
+LL | pub const unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
 |
 = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
... 11 lines skipped ...
 error: aborting due to 1 previous error
 
Full unnormalized output:
error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
##[error] --> /checkout/library/core/src/ptr/mod.rs:805:1
 |
LL | pub const unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) {
 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
 |
 = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
 = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
 = note: BACKTRACE:
 = note: inside `std::ptr::drop_in_place::<PartialDrop> - shim(Some(PartialDrop))` at /checkout/library/core/src/ptr/mod.rs:805:1: 805:68
note: inside `main`
 --> tests/fail/unaligned_pointers/drop_in_place.rs:25:9
 |
LL | core::ptr::drop_in_place(p);
 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
---
full stderr:
error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
##[error] --> /checkout/library/core/src/ptr/mod.rs:805:1
 |
LL | pub const unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) {
 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
 |
 = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
 = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
 = note: BACKTRACE:
 = note: inside `std::ptr::drop_in_place::<PartialDrop> - shim(Some(PartialDrop))` at /checkout/library/core/src/ptr/mod.rs:805:1: 805:68
note: inside `main`
 --> tests/fail/unaligned_pointers/drop_in_place.rs:25:9
 |
LL | core::ptr::drop_in_place(p);
 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
---
Location:
 /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ui_test-0.30.2/src/lib.rs:365
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 1: <color_eyre[3c4c3f14ce67c862]::config::EyreHook>::into_eyre_hook::{closure#0}<unknown>
 at <unknown source file>:<unknown line>
 2: eyre[27939c37cd2918af]::private::format_err<unknown>
 at <unknown source file>:<unknown line>
 3: ui_test[998f70e21c9d4f21]::run_tests_generic::<ui_test[998f70e21c9d4f21]::default_file_filter, ui[b420cc9bae658438]::run_tests::{closure#1}, alloc[38aebdd1529a32f0]::boxed::Box<dyn ui_test[998f70e21c9d4f21]::status_emitter::StatusEmitter>><unknown>
 at <unknown source file>:<unknown line>
 4: ui[b420cc9bae658438]::ui<unknown>
 at <unknown source file>:<unknown line>
 5: ui[b420cc9bae658438]::main<unknown>
 at <unknown source file>:<unknown line>
 6: std[6aac5b2b65832922]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[6d3892dd075386a0]::result::Result<(), eyre[27939c37cd2918af]::Report>, core[6d3892dd075386a0]::result::Result<(), eyre[27939c37cd2918af]::Report>><unknown>
 at <unknown source file>:<unknown line>
 7: std[6aac5b2b65832922]::rt::lang_start::<core[6d3892dd075386a0]::result::Result<(), eyre[27939c37cd2918af]::Report>>::{closure#0}<unknown>
 at <unknown source file>:<unknown line>
 8: std[6aac5b2b65832922]::rt::lang_start_internal<unknown>
 at <unknown source file>:<unknown line>
 9: main<unknown>
 at <unknown source file>:<unknown line>
 10: __libc_start_main<unknown>
 at <unknown source file>:<unknown line>
 11: _start<unknown>
 at <unknown source file>:<unknown line>
Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`
Caused by:
 process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/ui-de637b1a885c82e4` (exit status: 1)
Bootstrap failed while executing `test --stage 2 src/tools/miri src/tools/miri/cargo-miri`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo test --target x86_64-unknown-linux-gnu -Zbinary-dep-depinfo -j 4 -Zroot-dir=/checkout --locked --color always --release --manifest-path /checkout/src/tools/miri/Cargo.toml -- [workdir=/checkout]` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:189:21
Executed at: src/bootstrap/src/core/build_steps/test.rs:644:19
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:40:20
 local time: Thu Aug 21 21:58:42 UTC 2025
 network time: 2025年8月21日 21:58:42 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

Copy link
Contributor

Poking in since I'd like this for #145939 and you haven't fixed the tests yet. Would be willing to take over this if you aren't working on it right now.

Copy link
Contributor Author

Qelxiros commented Sep 2, 2025

I'm getting weird errors when I try to run miri, so you're welcome to pick this up.

clarfonthey reacted with thumbs up emoji

@ibraheemdev ibraheemdev added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 3, 2025
Copy link
Contributor Author

Qelxiros commented Sep 4, 2025

superseded by #146187

clarfonthey reacted with thumbs up emoji

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Labels
T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /