Skip to main content

embedding_for

Function embedding_for 

Source
pub fn embedding_for(
    target_err: TyId,
    source_err: TyId,
    types: &HashMap<String, Arc<TypeDecl>>,
    tys: &Types,
) -> Option<(String, String)>
Expand description

v0.154 (ADR 0178): the declared error embedding that converts source_err into target_err, if one exists. When target_err is a sum declaring embeds E as V with E compatible with source_err, returns (sum_type_name, variant_name) — the variant a value of source_err auto-wraps into. One level only: the source must match a declared embedding directly. Used by ? in the checker (to accept the conversion) and the emitter (to lower the Err-wrap) from the same rule, so the two cannot diverge.