-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow repr(align = x)
on inherent methods
#110313
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
#[no_mangle] | ||
#[repr(align(16))] | ||
pub fn method_align(self) {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a check for trait methods and associated functions, just to be sure? i.e.
} | |
// CHECK: align 16 | |
#[no_mangle] | |
#[repr(align(16))] | |
pub fn associated_fn() {} | |
} | |
trait T { | |
fn trait_fn() {} | |
fn trait_method(self) {} | |
} | |
impl T for A { | |
// CHECK: align 16 | |
#[no_mangle] | |
#[repr(align(16))] | |
fn trait_fn() {} | |
// CHECK: align 16 | |
#[no_mangle] | |
#[repr(align(16))] | |
fn trait_method(self) {} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should those be allowed? The current change doesn't allow those, but I can change it to include trait impls as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes, they should? Don't really see a reason to not allow these (btw maybe a test for default bodies should be added too, although I'm not sure if it's easy to do...).
Do we not have a test which shows the @bors r+ rollup |
@WaffleLapkin done. |
@bors r+ |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#104055 (Migrate diagnostics in `rustc_borrowck`) - rust-lang#110257 (fix false positives for `unused_parens` around unary and binary operations) - rust-lang#110313 (allow `repr(align = x)` on inherent methods) - rust-lang#110337 (Correct default value for default-linker-libraries) - rust-lang#110386 (Clean up traversal macros) - rust-lang#110394 (Various minor Idx-related tweaks) - rust-lang#110425 (Encode def span for `ConstParam`) - rust-lang#110434 (Check freeze with right param-env in `deduced_param_attrs`) - rust-lang#110455 (tests: adapt for LLVM change 5b386b8) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Discussion: #82232 (comment)