Skip to content

Conversation

@GrigorenkoPV
Copy link
Contributor

@GrigorenkoPV GrigorenkoPV commented Nov 9, 2025

As per #102070 (comment)

Tracking issue: #102070

Mostly duplicating methods that previously worked with usize-represented alignments.

Naming follows a convention of align: usize, alignment: Alignment.

Based on top of #148769

@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 Nov 9, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2025

r? @scottmcm

rustbot has assigned @scottmcm.
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

@rust-log-analyzer

This comment has been minimized.

@GrigorenkoPV
Copy link
Contributor Author

Conflicts with #148769, let's wait for that first

@GrigorenkoPV GrigorenkoPV marked this pull request as draft November 9, 2025 20:53
@rustbot rustbot 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 Nov 9, 2025
@joboet
Copy link
Member

joboet commented Nov 9, 2025

I really prefer the current spelling of Alignment::of as opposed to alignment_of and therefore would like to suggest adding of_val and of_val_raw as associated methods instead of free-standing functions in mem.

// (However, we do not analogously require `align >= sizeof(void*)`,
// even though that is *also* a requirement of `posix_memalign`.)
align: Alignment,
alignment: Alignment,
Copy link
Member

Choose a reason for hiding this comment

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

This rename is so big that github hides it by default.

Please make this PR just the api addition. If you also want to rename this field, that's fine, but please do it separately because of how much it touches.

Comment on lines 83 to 76
const fn is_size_alignment_valid(size: usize, alignment: Alignment) -> bool {
if size > Self::max_size_for_alignment(alignment) {
return false;
}
true
}
Copy link
Member

Choose a reason for hiding this comment

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

fix: you don't need the return, the true, or the false here.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GrigorenkoPV
Copy link
Contributor Author

Looks like the failure is due to the rename of master branch and is unrelated to this PR

@bors
Copy link
Collaborator

bors commented Nov 20, 2025

☔ The latest upstream changes (presumably #149109) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 Documenting core v0.0.0 (/checkout/library/core)
error: public documentation for `from_size_alignment_unchecked` links to private item `Layout::from_size_alignment`
   --> library/core/src/alloc/layout.rs:148:11
    |
148 |     /// [`Layout::from_size_alignment`].
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this item is private
    |
    = note: this link will resolve properly if you pass `--document-private-items`
    = note: `-D rustdoc::private-intra-doc-links` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(rustdoc::private_intra_doc_links)]`

error: public documentation for `adjust_alignment_to` links to private item `Layout::from_size_alignment`
   --> library/core/src/alloc/layout.rs:309:57
    |
309 |     /// `alignment` violates the conditions listed in [`Layout::from_size_alignment`].
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this item is private
    |
    = note: this link will resolve properly if you pass `--document-private-items`

error: could not document `core`
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] core test:false 25.385
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Command `/checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo doc --target aarch64-unknown-linux-gnu -Zbinary-dep-depinfo -j 4 -Zroot-dir=/checkout --locked --color=always --release -p alloc -p compiler_builtins -p core -p panic_abort -p panic_unwind -p proc_macro -p rustc-std-workspace-core -p std -p std_detect -p sysroot -p test -p unwind --features 'backtrace panic-unwind compiler-builtins-c' --manifest-path /checkout/library/sysroot/Cargo.toml --no-deps --target-dir /checkout/obj/build/aarch64-unknown-linux-gnu/stage1-std/aarch64-unknown-linux-gnu/doc -Zskip-rustdoc-fingerprint -Zrustdoc-map [workdir=/checkout]` failed with exit code 101
Created at: src/bootstrap/src/core/build_steps/doc.rs:795:21
Executed at: src/bootstrap/src/core/build_steps/doc.rs:828:22

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:30:41
  local time: Fri Dec 19 22:33:53 UTC 2025
  network time: Fri, 19 Dec 2025 22:33:54 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants