-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Align attr fixes #143206
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
base: master
Are you sure you want to change the base?
Align attr fixes #143206
Changes from all commits
308ef8d
278f4f4
55d0210
0382357
233e2ef
440bf29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//@ run-pass | ||
#![feature(fn_align)] | ||
|
||
trait Test { | ||
#[align(4096)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4096 is pretty big but I am realizing I don't see a test for oversized aligns that we should definitely reject, I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4096 I believe is the highest align that should work more or less everywhere. Because this test relies on converting to a function pointer, choosing a high value minimizes the chance of “getting lucky”. Rejecting high alignments on platforms that don’t support them is being worked on by others, I think. |
||
fn foo(&self); | ||
|
||
#[align(4096)] | ||
fn foo1(&self); | ||
} | ||
|
||
fn main() { | ||
assert_eq!((<dyn Test>::foo as fn(_) as usize & !1) % 4096, 0); | ||
assert_eq!((<dyn Test>::foo1 as fn(_) as usize & !1) % 4096, 0); | ||
} |
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.
Weren't we going to warn on applying
align
twice?I mean that shouldn't affect the codegen test, I'm just realizing that I don't know for sure if we have a test that does check that we warn.
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.
It would be nice to have a warning, but it’s not required for the MVP. It hasn’t been implemented yet.