-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
const
operands in asm!
should use inline consts rather than const promotion
#83169
Comments
(The syntax I suggested in the quote above is up for bikeshedding of course; the key point is that the const expression is treated separately from the start and we don't have to hot-fix the MIR later via promotion.) |
Surely it would just use the same syntax as inline |
asm!(
"mov {0}, {1}",
"add {0}, {number}",
out(reg) o,
in(reg) i,
number = const { 5 },
); |
Sure, although just as you say in your comment it should also be possible to elide the explicit const for the case of literals and named consts. I believe this exactly mirrors your plan for |
Well, the For arrays, there's not much of a "plan", but |
I made an attempt at switching |
Use AnonConst for asm! constants This replaces the old system which used explicit promotion. See rust-lang#83169 for more background. The syntax for `const` operands is still the same as before: `const <expr>`. Fixes rust-lang#83169 Because the implementation is heavily based on inline consts, we suffer from the same issues: - We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`. - We are hitting the same ICEs as inline consts, for example rust-lang#78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.
Use AnonConst for asm! constants This replaces the old system which used explicit promotion. See rust-lang#83169 for more background. The syntax for `const` operands is still the same as before: `const <expr>`. Fixes rust-lang#83169 Because the implementation is heavily based on inline consts, we suffer from the same issues: - We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`. - We are hitting the same ICEs as inline consts, for example rust-lang#78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.
Elevating an item from the
asm!
progress report from a comment to an issue so that it can be tracked:const
operands should switch to using the new inline consts instead of explicit promotion. In theory this should have no impact on existing code, but it requires inline consts to support references to generic paramters of the surrounding function, which is not supported yet.The text was updated successfully, but these errors were encountered: