-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Permit asm_const
and asm_sym
to reference generic params
#96800
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
LGTM! |
asm!("/* {0} */", const std::mem::size_of::<T>()); | ||
asm!("/* {0} */", const std::mem::size_of::<(T, T)>()); | ||
asm!("/* {0} */", sym barbar::<T>); | ||
asm!("/* {0} */", sym barbar::<(T, T)>); |
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.
We are missing a feature gate test for these constructs with generics I think.
r=me once asm-const and asm-sym feature gate tests are augmented. |
|
I don't think its necessary to add an entirely separate test, but I think augmenting the existing |
@bors r+ |
📌 Commit 441d98f has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (10d9ecd): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Related #96557
These constructs will be allowed:
@Amanieu, I didn't switch inline asms to use
DefKind::InlineAsm
, as I see little value doing that; given that no type inference is needed, it will only make typecking slower and more complex but will have no real gains. I did switch them to follow the same code path as inline asm during symbol resolution, though.The
error: unconstrained generic constant
you mentioned in #76001 is due to the fact thatto_const
will actually add a wfness obligation to the constant, which we don't need forasm_const
, so I have that removed.@rustbot label: +A-inline-assembly +F-asm