Handle asm const similar to inline const by nbdd0121 · Pull Request #137686 · rust-lang/rust (original) (raw)
Previously, asm consts are handled similar to anon consts rather than inline consts. Anon consts are not good at dealing with lifetimes, because type_of
has lifetimes erased already. Inline consts can deal with lifetimes because they live in an outer typeck context. And since global_asm!
lacks an outer typeck context, we have implemented asm consts with anon consts while they're in fact more similar to inline consts.
This was changed in #137180, and this means that handling asm consts as inline consts are possible. While as @compiler-errors pointed out, const
currently can't be used with any types with lifetime, this is about to change if #128464 is implemented. This PR is a preparatory PR for that feature.
As an unintentional side effect, fix #117877.
cc @Amanieu
r? @compiler-errors