Skip to content

Expose regular argument attributes in rustc_public - #163242

Open
nihalpasham wants to merge 4 commits into
rust-lang:mainfrom
nihalpasham:rustc-public-arg-attributes
Open

nihalpasham wants to merge 4 commits into
rust-lang:mainfrom
nihalpasham:rustc-public-arg-attributes

Conversation

@nihalpasham

@nihalpasham nihalpasham commented Sep 24, 2026 •

Copy link
Copy Markdown

Add ArgAttributes::regular() and ArgAttributeFlags so consumers can read the argument flags already computed by rustc. The conversion preserves all ten flags, including the overlapping capture flags.

Clarifies what pointee_size guarantees at function entry and return, and how no_free affects rustc's emission of LLVM dereferenceability attributes.

Fixes rust-lang/rustc_public#132.

r? @makai410

@rustbot

rustbot commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

@rustbot rustbot added 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. labels Sep 24, 2026
@rustbot

rustbot commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @makai410 (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Comment thread compiler/rustc_public/src/abi.rs
Comment thread tests/ui-fulldeps/rustc_public/check_abi.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Comment on lines +72 to +74
.expect("Expected ComplexFn signature")
.fn_ptr_abi()
.expect("Expected ComplexFn ABI");

@makai410 makai410 Oct 6, 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.

(I think that would be... okay to do unwrap() here, though... nvm, it doesn't matter :P)

View changes since the review

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, unwrap() would be fine here too but just for the extra context, I kept expect().

non_null: true,
read_only: false,
no_free: false,
pointee_size: 0,

@makai410 makai410 Oct 7, 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.

Curious why this was changed to 0? I saw that it was 4 before and passed CI

View changes since the review

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This came up in the CI run, which failed with actual 0, expected 4.

After some digging, I found that [#158863] had landed since I opened this PR and changed this for non-Freeze shared references like &Cell<u32>. The cell is still 4 bytes, but rustc now reports zero because extra speculative reads aren’t safe here.

Figured I’d just update the expectation to match.

@rust-bors

rust-bors Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

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

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

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PassMode carries ArgAttributes only as Opaque; can we expose a typed mirror?

4 participants