Normalize passes keep spans and clean warnings

This commit is contained in:
nyash-codex
2025-11-24 15:02:51 +09:00
parent 466e636af6
commit da1a5558e5
40 changed files with 547 additions and 362 deletions

View File

@ -41,8 +41,8 @@ fn analyze_function(func: &MirFunction) -> EscapeInfo {
let mut info = EscapeInfo::default();
// Collect local boxes: results of NewBox in this function
for block in func.blocks.values() {
for ins in block.instructions.iter() {
if let MirInstruction::NewBox { dst, .. } = ins {
for sp in block.iter_spanned() {
if let MirInstruction::NewBox { dst, .. } = sp.inst {
info.local_boxes.insert(*dst);
}
}
@ -54,8 +54,8 @@ fn analyze_function(func: &MirFunction) -> EscapeInfo {
}
// Conservative escape marking
for block in func.blocks.values() {
for ins in block.all_instructions() {
match ins {
for sp in block.all_spanned_instructions() {
match sp.inst {
MirInstruction::Return { value: Some(v) } => {
if info.local_boxes.contains(v) {
info.escaping.insert(*v);