Skip to content

"use of local which has no storage here" at -Zmir-opt-level=0 #144932

@saethlin

Description

@saethlin

I ran into this in my PR #131650 (comment) when trying to use GVN more, because MIR "lints" are enabled in the mir-opt suite.

This lint fires a fair bit in the ecosystem, for example in zvariant-5.6.0, compiling with RUSTFLAGS="-Zlint-mir -Zmir-opt-level=0 -Zmir-enable-passes=+GVN" cargo +nightly build

error: internal compiler error: broken MIR in Item(DefId(0:1107 ~ zvariant[4905]::dbus::ser::{impl#4}::serialize_struct_element)) (after pass SanityCheck) at bb46[0]: use of local _10, which has no storage here --> src/dbus/ser.rs:540:5 | 540 | } | ^ | note: delayed at compiler/rustc_mir_transform/src/lint.rs:74:22 0: <rustc_errors::DiagCtxtInner>::emit_diagnostic 1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic 2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee 3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String> 4: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String> 5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local 6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place 7: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator 8: rustc_mir_transform::lint::lint_body 9: rustc_mir_transform::mir_built <snip>

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions