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 85
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
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  PR_CI_JOB: 1
  SKIP_SUBMODULES: src/gcc
  IMAGE: tidy
##[endgroup]
error: PRs changing the `nightly` channel should be sent to the `master` branch!
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"
echo "disk usage:"
df -h
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}

@GrigorenkoPV
Copy link
Contributor Author

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

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.

5 participants