Skip to content

Compute metadata and layout for unsafe binders - #166291

Open
jackh726 wants to merge 2 commits into
rust-lang:mainfrom
jackh726:unsafe-binders-metadata
Open

jackh726 wants to merge 2 commits into
rust-lang:mainfrom
jackh726:unsafe-binders-metadata

Conversation

@jackh726

@jackh726 jackh726 commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Based on #166290
Split from #163515

Closes #154871

r? adwinwhite

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Nov 21, 2026
@jackh726

Copy link
Copy Markdown
Member Author

Disclosure: An LLM was used to help generate the tests and to experiment with early prototypes of the pointee normalization code (though I wrote the code in this PR from scratch).

@jackh726 jackh726 added the llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. label Nov 21, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-cloud-vms
rust-cloud-vms Bot force-pushed the unsafe-binders-metadata branch from 6510d77 to 509f5d7 Compare November 24, 2026 02:55
@jackh726
jackh726 marked this pull request as ready for review November 24, 2026 02:57
@rustbot

rustbot commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/unsafe-binders/pointee/metadata-after-monomorphization.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsafe-binders/pointee/metadata-after-monomorphization/metadata-after-monomorphization.stderr`
diff of stderr:

+ error: internal compiler error: compiler/rustc_middle/src/ty/util.rs:LL:CC: unexpected unsized tail: Binder { value: std::mem::ManuallyDrop<Wd<'^0, dyn [Binder { value: Trait(std::fmt::Debug), bound_vars: [] }] + '^0>>, bound_vars: [Region(BrAnon)] }
1 
- thread 'rustc' ($TID) panicked at compiler/rustc_codegen_llvm/src/debuginfo/utils.rs:LL:CC:
- wide_pointer_kind() - Encountered unexpected `pointee_tail_ty`: Binder { value: std::mem::ManuallyDrop<[&'^0 u8]>, bound_vars: [Region(BrAnon)] }
- error: the compiler unexpectedly panicked. This is a bug
+ 
+ thread 'rustc' ($TID) panicked at compiler/rustc_middle/src/ty/util.rs:LL:CC:
+ Box<dyn Any>
+ error: aborting due to 1 previous error
5 
6 

Note: some mismatched output was normalized before being compared
##[error]- error: internal compiler error: compiler/rustc_middle/src/ty/util.rs:240:18: unexpected unsized tail: Binder { value: std::mem::ManuallyDrop<Wd<'^0, dyn [Binder { value: Trait(std::fmt::Debug), bound_vars: [] }] + '^0>>, bound_vars: [Region(BrAnon)] }
- thread 'rustc' (208208) panicked at compiler/rustc_middle/src/ty/util.rs:240:18:
- note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+ error: internal compiler error: compiler/rustc_middle/src/ty/util.rs:LL:CC: unexpected unsized tail: Binder { value: std::mem::ManuallyDrop<Wd<'^0, dyn [Binder { value: Trait(std::fmt::Debug), bound_vars: [] }] + '^0>>, bound_vars: [Region(BrAnon)] }

- note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
- 
- note: please make sure that you have updated to the latest nightly
- 
- note: rustc 1.102.0-nightly (055cc8a60 2026-11-24) running on x86_64-unknown-linux-gnu
- 
- note: compiler flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -Z codegen-backend=gcc -Z threads=1 -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -Z next-solver=coherence -C rpath -Z next-solver -Z unstable-options -C symbol-mangling-version=legacy -C debuginfo=2
- 
- query stack during panic:
- end of query stack
+ thread 'rustc' ($TID) panicked at compiler/rustc_middle/src/ty/util.rs:LL:CC:
+ Box<dyn Any>
+ error: aborting due to 1 previous error


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args unsafe-binders/pointee/metadata-after-monomorphization.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: env -u RUSTC_LOG_COLOR LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsafe-binders/pointee/metadata-after-monomorphization/auxiliary:" RUSTC_ICE="0" RUST_BACKTRACE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/unsafe-binders/pointee/metadata-after-monomorphization.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-Zthreads=1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unsafe-binders/pointee/metadata-after-monomorphization" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Znext-solver" "-Zunstable-options" "-Csymbol-mangling-version=legacy" "-Cdebuginfo=2"
stdout: none
--- stderr -------------------------------
##[error]error: internal compiler error: compiler/rustc_middle/src/ty/util.rs:240:18: unexpected unsized tail: Binder { value: std::mem::ManuallyDrop<Wd<'^0, dyn [Binder { value: Trait(std::fmt::Debug), bound_vars: [] }] + '^0>>, bound_vars: [Region(BrAnon)] }


thread 'rustc' (208208) panicked at compiler/rustc_middle/src/ty/util.rs:240:18:
Box<dyn Any>
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.102.0-nightly (055cc8a60 2026-11-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -Z codegen-backend=gcc -Z threads=1 -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -Z next-solver=coherence -C rpath -Z next-solver -Z unstable-options -C symbol-mangling-version=legacy -C debuginfo=2

query stack during panic:
end of query stack
error: aborting due to 1 previous error
------------------------------------------

Important

For more information how to resolve CI failures of this job, visit this link.

Comment on lines +552 to +553
&ty::UnsafeBinder(inner) => {
self.check_wide_ptr_meta(meta, inner.skip_binder())?;

@RalfJung RalfJung Nov 24, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't struct_tail_for_codegen recurse below UnsafeBinder to return the actual tail type?

View changes since the review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: ptr::null with unsafe binder

5 participants