Skip to main content

render_compilation_issue_miette

Function render_compilation_issue_miette 

Source
pub fn render_compilation_issue_miette(
    top_level_filename: &str,
    top_level_source: &str,
    source_files: &IndexMap<ModuleId, ModuleSource>,
    issue: CompilationIssue,
) -> String
Expand description

Render a CompilationIssue as a miette report string, mirroring the formatting used for Report. The issue is rendered against the module its source range points into: issues from imported modules use their entry in source_files, while top-level issues use top_level_filename and top_level_source, since callers know the real top-level filename (e.g. an absolute path) while source_files only records the module path. The top-level pair is also the fallback when the module is missing from source_files, so callers without a source map can pass an empty one.