rust icon indicating copy to clipboard operation
rust copied to clipboard

Tidy up maybe_uninit_write_slice API

Open SUPERCILEX opened this issue 2 years ago • 5 comments

  • Move methods to extensions

SUPERCILEX avatar Oct 17 '22 00:10 SUPERCILEX

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

rustbot avatar Oct 17 '22 00:10 rustbot

r? @scottmcm

(rust-highfive has picked a reviewer for you, use r? to override)

rust-highfive avatar Oct 17 '22 00:10 rust-highfive

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)
configure: rust.debug-assertions := True
configure: rust.overflow-checks := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
Attempting with retry: make prepare
---
 Documenting core v0.0.0 (/checkout/library/core)
error: unresolved link to `write_slice_cloned`
    --> library/core/src/mem/maybe_uninit.rs:1180:49
     |
1180 |     /// If `T` does not implement `Copy`, use [`write_slice_cloned`]
     |                                                 ^^^^^^^^^^^^^^^^^^ no item named `write_slice_cloned` in scope
     |
     = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
     = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
error: unresolved link to `write_slice`
    --> library/core/src/mem/maybe_uninit.rs:1234:41
     |
     |
1234 |     /// If `T` implements `Copy`, use [`write_slice`]
     |
     |
     = 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 -Zunstable-options --check-cfg 'names()' --check-cfg 'values()' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -Z unstable-options --resource-suffix 1.66.0 --markdown-css rust.css --markdown-no-toc --index-page /checkout/src/doc/index.md -C metadata=abbb49baeba48eac -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/release/deps --cfg=bootstrap -Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(stdarch_intel_sde)' '--check-cfg=values(no_fp_fmt_parse)' '--check-cfg=values(no_global_oom_handling)' '--check-cfg=values(no_rc)' '--check-cfg=values(no_sync)' '--check-cfg=values(freebsd12)' '--check-cfg=values(backtrace_in_libstd)' '--check-cfg=values(target_env,"libnx")' '--check-cfg=values(target_os,"watchos")' '--check-cfg=values(target_arch,"asmjs","spirv","nvptx","nvptx64","le32","xtensa")' '--check-cfg=values(dont_compile_me)' '--check-cfg=values(rustix_use_libc)' --document-private-items -Dwarnings '-Wrustdoc::invalid_codeblock_attributes' --crate-version '1.66.0-nightly
  (b1f4b0c63
  2022-10-17)' '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")'` (exit status: 1)

rust-log-analyzer avatar Oct 17 '22 00:10 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
Rustbook (x86_64-unknown-linux-gnu) - edition-guide
Rustbook (x86_64-unknown-linux-gnu) - style-guide
Building stage0 tool linkchecker (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.19s
core/primitive.slice.html:59: broken link - `core/%5BMaybeUninit%3CT%3E%5D::write_slice_cloned`
core/primitive.slice.html:89: broken link - `core/%5BMaybeUninit%3CT%3E%5D::write_slice`
std/vec/struct.Vec.html:1261: broken link - `std/vec/%5BMaybeUninit%3CT%3E%5D::write_slice_cloned`
std/vec/struct.Vec.html:1291: broken link - `std/vec/%5BMaybeUninit%3CT%3E%5D::write_slice`
std/io/struct.IoSliceMut.html:167: broken link - `std/io/%5BMaybeUninit%3CT%3E%5D::write_slice_cloned`
std/io/struct.IoSliceMut.html:197: broken link - `std/io/%5BMaybeUninit%3CT%3E%5D::write_slice`
std/primitive.slice.html:279: broken link - `std/%5BMaybeUninit%3CT%3E%5D::write_slice_cloned`
std/primitive.slice.html:309: broken link - `std/%5BMaybeUninit%3CT%3E%5D::write_slice`
alloc/vec/struct.Vec.html:1405: broken link - `alloc/vec/%5BMaybeUninit%3CT%3E%5D::write_slice_cloned`
alloc/vec/struct.Vec.html:1435: broken link - `alloc/vec/%5BMaybeUninit%3CT%3E%5D::write_slice`
number of HTML files scanned: 33327
number of HTML redirects found: 10223
number of links checked: 2505957
number of links ignored due to external: 118853

rust-log-analyzer avatar Oct 17 '22 01:10 rust-log-analyzer

Thanks for the PR!

While I'm sometimes willing to add new APIs without libs-api assent, I'm much more worried about churning signatures without contacting them to see if they like them, since it would be a shame to find out they didn't and have to revert it and have impacted nightly users unnecessarily.

Could you please file an ACP for this set of changes (I think #103128 #103130 #103131 could probably all be one) to get a "yup, that seems better" from the team?

@rustbot author

scottmcm avatar Oct 17 '22 17:10 scottmcm

:umbrella: The latest upstream changes (presumably #108538) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Feb 27 '23 22:02 bors

@SUPERCILEX any updates on this?

Dylan-DPC avatar May 17 '23 06:05 Dylan-DPC

I'm not quite sure what the status is: https://github.com/rust-lang/libs-team/issues/122#issuecomment-1320960065

We generally agreed that these slice methods shouldn't exist, but they'll probably be here for a while. I do think that if we end up stabilizing them, it should be like this, not as a static method. The hope would be that they never need to get stabilized though.

SUPERCILEX avatar May 17 '23 06:05 SUPERCILEX

See https://github.com/rust-lang/libs-team/issues/122#issuecomment-1385409719. These are a bit too heavy weight to become inherent methods. I still think they should be renamed, but that can be discussed before stabilization.

SUPERCILEX avatar Jun 17 '23 18:06 SUPERCILEX