rust icon indicating copy to clipboard operation
rust copied to clipboard

Clarify safety of layout_for_ptr

Open CAD97 opened this issue 7 months ago • 8 comments

There is one functional change in the language update: we no longer document the behavior when given an external type, letting it fall into the "unknown" unsized tail kinds which are forbidden from use. This is in preparation for hopefully stabilizing this functionality in some form; the behavior of external types is still up in the air (recent temperature being to attempt adding a new default bound to current editions in order to forbid querying the layout external types entirely).

CAD97 avatar Nov 16 '23 22:11 CAD97

r? @thomcc

(rustbot has picked a reviewer for you, use r? to override)

rustbot avatar Nov 16 '23 22:11 rustbot

  • Tracking issue link: #69835

CAD97 avatar Nov 16 '23 22:11 CAD97

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_1f71be7f-828c-4585-8350-aec79c2c1a64
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=layout-for-ptr
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_1f71be7f-828c-4585-8350-aec79c2c1a64
GITHUB_REF=refs/pull/117991/merge
GITHUB_REF_NAME=117991/merge
GITHUB_REF_PROTECTED=false
---
   Compiling compiler_builtins v0.1.103
error: unresolved link to `ABI`
   --> library/core/src/mem/mod.rs:492:18
    |
492 | /// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
    |
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
    = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(rustdoc::broken_intra_doc_links)]`
error: unresolved link to `size_of`
   --> library/core/src/alloc/layout.rs:184:44
    |
    |
184 |     ///   equivalent to [`size_of::<T>()`][size_of]. The pointer is unused.
    |                                            ^^^^^^^ no item named `size_of` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
error: could not document `core`

Caused by:
Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2021 --crate-type lib --crate-name core library/core/src/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/doc/x86_64-unknown-linux-gnu/doc -Zunstable-options --check-cfg 'cfg(feature, values("debug_refcell", "panic_immediate_abort"))' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=a1aec6da431e1dc8 -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/doc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/doc/release/deps --cfg=bootstrap -Csymbol-mangling-version=legacy -Zunstable-options '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap,values())' '--check-cfg=cfg(stdarch_intel_sde,values())' '--check-cfg=cfg(no_fp_fmt_parse,values())' '--check-cfg=cfg(no_global_oom_handling,values())' '--check-cfg=cfg(no_rc,values())' '--check-cfg=cfg(no_sync,values())' '--check-cfg=cfg(freebsd12,values())' '--check-cfg=cfg(freebsd13,values())' '--check-cfg=cfg(backtrace_in_libstd,values())' '--check-cfg=cfg(target_env,values("libnx"))' '--check-cfg=cfg(target_arch,values("asmjs","spirv","nvptx","xtensa"))' --document-private-items --document-hidden-items -Dwarnings '-Wrustdoc::invalid_codeblock_attributes' --crate-version '1.76.0-nightly (f4836219f 2023-11-16)' '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' '-Zcrate-attr=warn(rust_2018_idioms)' -Z unstable-options --resource-suffix 1.76.0 --markdown-css rust.css --markdown-no-toc --index-page /checkout/src/doc/index.md` (exit status: 1)
Build completed unsuccessfully in 0:00:09
  local time: Thu Nov 16 22:25:24 UTC 2023
  network time: Thu, 16 Nov 2023 22:25:24 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Nov 16 '23 22:11 rust-log-analyzer

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_4de4bddb-0467-4e67-99c3-a1d66cbbea3b
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=layout-for-ptr
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_4de4bddb-0467-4e67-99c3-a1d66cbbea3b
GITHUB_REF=refs/pull/117991/merge
GITHUB_REF_NAME=117991/merge
GITHUB_REF_PROTECTED=false
---
   Compiling compiler_builtins v0.1.103
error: unresolved link to `size_of`
   --> library/core/src/alloc/layout.rs:184:44
    |
184 |     ///   equivalent to [`size_of::<T>()`][size_of]. The pointer is unused.
    |                                            ^^^^^^^ no item named `size_of` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
    = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(rustdoc::broken_intra_doc_links)]`
error: could not document `core`

Caused by:
Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2021 --crate-type lib --crate-name core library/core/src/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/doc/x86_64-unknown-linux-gnu/doc -Zunstable-options --check-cfg 'cfg(feature, values("debug_refcell", "panic_immediate_abort"))' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=a1aec6da431e1dc8 -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/doc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/doc/release/deps --cfg=bootstrap -Csymbol-mangling-version=legacy -Zunstable-options '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap,values())' '--check-cfg=cfg(stdarch_intel_sde,values())' '--check-cfg=cfg(no_fp_fmt_parse,values())' '--check-cfg=cfg(no_global_oom_handling,values())' '--check-cfg=cfg(no_rc,values())' '--check-cfg=cfg(no_sync,values())' '--check-cfg=cfg(freebsd12,values())' '--check-cfg=cfg(freebsd13,values())' '--check-cfg=cfg(backtrace_in_libstd,values())' '--check-cfg=cfg(target_env,values("libnx"))' '--check-cfg=cfg(target_arch,values("asmjs","spirv","nvptx","xtensa"))' --document-private-items --document-hidden-items -Dwarnings '-Wrustdoc::invalid_codeblock_attributes' --crate-version '1.76.0-nightly (5807d04be 2023-11-16)' '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' '-Zcrate-attr=warn(rust_2018_idioms)' -Z unstable-options --resource-suffix 1.76.0 --markdown-css rust.css --markdown-no-toc --index-page /checkout/src/doc/index.md` (exit status: 1)
Build completed unsuccessfully in 0:00:09
  local time: Thu Nov 16 22:44:13 UTC 2023
  network time: Thu, 16 Nov 2023 22:44:13 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Nov 16 '23 22:11 rust-log-analyzer

I'm going to be away for a few months, so I'm rerolling my PRs so that folks don't have to wait for me. Sorry/thanks.

r? libs

thomcc avatar Feb 01 '24 22:02 thomcc

Please resolve the mingw-check failure.

@rustbot author

cuviper avatar Feb 11 '24 05:02 cuviper

I'd love to see some progress here. :)

@CAD97 what is this blocked on? Figuring out who can approve it?

RalfJung avatar May 13 '24 18:05 RalfJung

Finding someone to approve it, but also me forgetting that there's a silly doc link error that needs to be fixed (which is why it's still labeled waiting on author). I'll address that and your comments today or tomorrow (ping me if I haven't in the next 48 hours, thanks).

CAD97 avatar May 14 '24 00:05 CAD97