In librustc_ast_lowering I turn
hir::ExprKind::Err if the current target doesn't support inline asm or if an invalid register is used for an operand. Unfortunately this seems to lead to crashes later on (#72570) since the expressions used in the asm operands aren't lowered to HIR and are therefore missing
Is it valid to lower something to
hir:ExprKind::Err? If not then I guess I have to make up some semi-valid HIR to keep the compiler happy. Until what point do I need to keep this HIR valid?
I've encountered the same issue, let me find the PR
So i did not properly fix the lowering per say, but i ended up to the same conclusion, being that generating
hir:ExprKind::Err nodes make the HIR invalid and it breaks/crash later on
I think you need to eagerly lower all expressions even if you are throwing them away later
but we may be able to come up with a better scheme
where are the
HirIds to the asm operands? Maybe we need to ensure these ids are never stored anywhere?
I haven't managed to get a proper backtrace from the crash yet.
Building rustc with debuginfo takes forever :/
I don't remember it taking any additional time
did you leave optimizations enabled?
Yes, the LTO at the end is the part that takes a while.
I'm currently trying to eagerly lower all sub-expressions as you suggest.
OK that seems to have solved the issue, thanks!
I had some early exit logic on error which I removed. I still emit
hir::ExprKind::Err but I now call
lower_expr_mut on all sub-expressions.
:+1: if you have the time please open an issue about this (with the ICE message about the missing
HirId, so that people can find it when they hit the same problem). Mentioning the solution and asking for something allowing us to make it simpler to eagerly bail out early.