diem/diem · error
ICE expansion failed
Error message
ICE expansion failed
What it means
This ICE panic in `add_drop_ability_tip` (language/move-lang/src/cfgir/locals/mod.rs:369) fires when computing abilities for a type argument and the type is still `T::Var(_)` or `T::Apply(None, _, _)` — i.e. the type-expansion pass has not run or failed. The compiler expects every type reaching CFGIR analysis to be fully expanded with concrete abilities. It indicates a broken internal invariant, typically a compiler bug.
Source
Thrown at language/move-lang/src/cfgir/locals/mod.rs:369
t
),
};
crate::typing::core::ability_not_satisified_tips(
&crate::typing::core::Subst::empty(),
diag,
Ability_::Drop,
&ty,
declared_loc_opt,
declared_abilities,
ty_args.iter().map(|ty_arg| {
let abilities = match &ty_arg.value {
T::Unit => AbilitySet::collection(ty_arg.loc),
T::Ref(_, _) => AbilitySet::references(ty_arg.loc),
T::UnresolvedError | T::Anything => AbilitySet::all(ty_arg.loc),
T::Param(TParam { abilities, .. }) | T::Apply(Some(abilities), _, _) => {
abilities.clone()
}
T::Var(_) | T::Apply(None, _, _) => panic!("ICE expansion failed"),
};
(ty_arg, abilities)
}),
)
}
fn single_type_to_naming_type(sp!(loc, st_): SingleType) -> N::Type {
sp(loc, single_type_to_naming_type_(st_))
}
fn single_type_to_naming_type_(st_: SingleType_) -> N::Type_ {
use SingleType_ as S;
use N::Type_ as T;
match st_ {
S::Ref(mut_, b) => T::Ref(mut_, Box::new(base_type_to_naming_type(b))),
S::Base(sp!(_, b_)) => base_type_to_naming_type_(b_),
}
}View on GitHub (pinned to fc4714a8ea)
Solutions
- Fix the unresolved type references in the Move source so expansion succeeds (check imports and type names) before the analysis runs.
- Minimize the failing program and report the ICE to the Move compiler maintainers.
- Retry with a different/newer compiler version where the expansion bug may be fixed.
Example fix
// before (type that fails to expand) let x: UnknownType = ...; // after (fully resolvable type) use 0x1::vector; let x: vector<u8> = vector::empty();
Defensive patterns
Strategy: validation
Validate before calling
// ensure all imports/types resolve before compilation
// (check compiler diagnostics after parsing/expansion pass)
if diagnostics_after_expansion(env) { return Err("unresolved types"); } Try / catch
std::panic::catch_unwind(|| run_cfgir_locals(ast))
.map_err(|_| "compiler ICE: unexpanded type")?; Prevention
- Fix all unresolved type/import errors before later compilation phases.
- Do not run CFGIR passes manually on partially-expanded ASTs.
- Report minimized ICEs and update the compiler to a fixed release.
When it happens
Trigger: Type expansion did not resolve a type variable or left an unexpanded `T::Apply(None, ...)` node, and locals analysis then inspects that type argument while constructing a drop-ability tip from a `command` or `lvalue`.
Common situations: Compiling code containing types the expansion pass could not resolve (unresolved module/type names that were not surfaced as errors earlier); compiler bugs/regressions; stale intermediate artifacts from a mismatched compiler version.
Related errors
- ICE either the type did not have 'drop' when it should have
- {:#?}{:#?}
- ICE inferred num should have been expanded
- ICE unexpected jump before translation to jumps
- internal error: entered unreachable code
AI-assisted analysis of diem/diem@fc4714a8ea (2026-09-04).
Data as JSON: /api/errors/3c733cd1200a1b3a.
Report an issue: GitHub.