Preserve expression assembly result types when recording HIR conversions
维护者通常 1 天内回复
评估
调研方向
Start at front/parser/src/verification/expression.rs, especially validate_expr_asm_block, which the issue identifies as returning Unknown. Trace how typed HIR records ordered conversions for initializers, returns, arithmetic, and casts, then check how LLVM consumes them. Done means supported typed scalar outputs preserve language conversions, unsupported contexts produce source diagnostics, and existing expression-asm regressions pass.
由索引模型根据 Issue 内容生成。
描述
Problem
Expression-form assembly always validates to ExpressionType::Unknown even when its single output has a concrete scalar type. An enclosing initializer or return can therefore pass checking without the numeric conversion required by LLVM lowering. Ordinary arithmetic and explicit casts also see unknown rather than the typed result.
Starting point: validate_expr_asm_block, which returns Unknown after validating its operands.
Reproduction
Audited canonical master e1f8effd195b6339c3979b1e091e63c25f1da983 on Linux amd64 with checkout-built Wave 0.0.1-alpha-dev, matching std, Rust 1.89.0, Cargo jobs=2 and LLVM 21.1.8. The master SHA was rechecked before registration.
fun main() {
var sink: i64 = 0;
var result: bool = asm {
"mov rax, 7"
out("rax") sink
clobber("nostack")
};
}
target/debug/wavec --std-root "$PWD/std" check repro.wave
target/debug/wavec --std-root "$PWD/std" --error-format=json build repro.wave --emit=ir --out-dir .tmp/asm-type-repro
check exits 0. IR generation exits 1 with E9001:
ICE: numeric boundary conversion missing from HIR: variable 'result' initializer
compiler panic location: llvm/src/statement/variable.rs:83:13
Changing result to f64 produces the same failure. Returning the expression from a function declared -> i32 also passes check and fails with missing HIR conversion ret_cast. In a separate control, adding an integer to the expression or explicitly casting it is rejected because the result is unknown.
Scope
Determine the expression's established single-output result type in semantic analysis and preserve required ordered conversions in Typed HIR. LLVM must consume those facts rather than inventing conversions. Unsupported or incompatible contexts need a source diagnostic before code generation. Preserve the single-result output contract and one evaluation of asm and its operands.
Related: #512 is input-expression lowering and #679 is asm-initializer binding registration. Neither fixes the result-type/conversion boundary described here.
Completion criteria
- Typed scalar asm results participate in supported initializers, returns, arithmetic and casts without Unknown leaking into validated HIR.
- Supported bool/float/integer conversions follow existing language rules, widths and evaluation order.
- Unsupported contexts fail with a source diagnostic rather than E9001.
- Existing expression-asm input, output-count, binding and side-effect regressions continue to pass.
- 主要语言
- Rust
- 星标
- 56
- 派生
- 21
- 平均合并
- 23 小时 20 分钟
- 30 天内合并 PR
- 45
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wavefnd/Wave 的其他 Issue
-
Reject unrepresentable POSIX listener descriptors before Unix-domain accept可能已有人在做 @ShahadatTest 于 5 天前认领。 未关闭bug good first issue
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug help wanted
难度 4/5 3-5 天 新手友好度 53/100
维护者通常 1 天内回复
-
Preserve the previous build output when writing its Cargo receipt fails可能已有人在做 @hiyouwhatsapp 今天认领。 未关闭bug build help wanted
难度 4/5 3-5 天 新手友好度 56/100
维护者通常 1 天内回复
-
Reconcile obsolete staging assets before verifying a new Nightly generation可能已有人在做 @hiyouwhatsapp 于 1 天前认领。 未关闭bug ci help wanted
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
Prevent compiler stack overflow on long acyclic forward type-alias chains可能已有人在做 @hiyouwhatsapp 于 5 天前认领。 未关闭bug
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
n0-computer/iroh#4669 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
rubys/roundhouse#1950 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
cloudflare/workers-rs#1130 ·
维护者通常 11 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
vfarcic/dot-agent-deck#2160 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
RustCrypto/utils#1597 ·
维护者通常 1 天内回复