Skip to content

Add type context to expect() panic in monomorphization #3

@Apocky

Description

@Apocky

Summary

cssl-mir/src/monomorph.rs:1195 panics with a generic message:

.expect("impl block not found");

When this fires during development, there's no indication of which type or function was being monomorphized, making it hard to debug.

What to do

Replace the bare expect() with one that includes the relevant type information:

.unwrap_or_else(|| panic!(
    "impl block not found for type {:?} during monomorphization of {:?}",
    concrete_ty, fn_name   // use whatever variables are in scope
))

You'll need to read the surrounding code to find the right variable names.

Why this is a good first issue

  • Single-line change with real diagnostic value
  • Requires reading a small section of monomorph.rs to understand the context
  • Teaches how monomorphization works in the MIR pass
  • No extern dependencies or unsafe code involved

Files

  • compiler-rs/crates/cssl-mir/src/monomorph.rs (line 1195)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions