const TEMPLATE: &str = "<!DOCTYPE html>\n<html>\n<head>\n<title>Polonius MIR dump</title>\n<style>\npre {\n margin-top: 0;\n white-space: pre-wrap;\n}\n\n.section + .section {\n margin-top: 20px;\n border-top: 1px solid #aaa;\n padding-top: 10px;\n}\n\n.section-header {\n margin-bottom: 6px;\n}\n\n.trace + .trace {\n margin-top: 15px;\n}\n\n.trace ul {\n margin: 5px 0px;\n padding-left: 15px;\n}\n\n.trace-suffix {\n opacity: 0.8;\n margin-left: 10px;\n}\n\n.hidden {\n display: none;\n}\n</style>\n</head>\n\n<body>\n\n<!-- Links to the other sections -->\n<div class=\"section\">\n <div class=\"section-header\">Quick links</div>\n <a href=\"#mir\">Polonius MIR</a>\n <a href=\"#polonius-region-graph\">Polonius constraint graph</a>\n <a href=\"#loan-traces\">Loan traces</a>\n <a href=\"#cfg-graph\">Control-flow graph</a>\n <a href=\"#nll-region-graph\">NLL region graph</a>\n <a href=\"#nll-scc-graph\">NLL SCC graph</a>\n</div>\n\n<!-- The NLL + Polonius MIR -->\n<div class=\"section\" id=\"mir\">\n <div class=\"section-header\">Raw MIR dump</div>\n <pre><code>$SECTION_MIR</code></pre>\n</div>\n\n<!-- Mermaid visualization of the polonius constraint graph -->\n<div class=\"section\" id=\"polonius-region-graph\">\n <div class=\"section-header\">Polonius constraint graph</div>\n <pre class=\'mermaid\'>$SECTION_POLONIUS_CONSTRAINTS</pre>\n</div>\n\n<!-- The reachability of loans while traversing the polonius constraint graph -->\n<div class=\"section traces\" id=\"loan-traces\">\n <div class=\"section-header\">Loan Traces</div>\n $SECTION_POLONIUS_REACHABILITY\n</div>\n\n<!-- Mermaid visualization of the CFG -->\n<div class=\"section\" id=\"cfg-graph\">\n <div class=\"section-header\">Control-flow graph</div>\n <pre class=\'mermaid\'>$SECTION_CFG</pre>\n</div>\n\n<!-- Mermaid visualization of the NLL region graph -->\n<div class=\"section\" id=\"nll-region-graph\">\n <div class=\"section-header\">NLL regions</div>\n <pre class=\'mermaid\'>$SECTION_NLL_CONSTRAINTS</pre>\n</div>\n\n<!-- Mermaid visualization of the NLL SCC graph -->\n<div class=\"section\" id=\"nll-scc-graph\">\n <div class=\"section-header\">NLL SCCs</div>\n <pre class=\'mermaid\'>$SECTION_NLL_SCCS</pre>\n</div>\n\n<script src=\'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js\'></script>\n$SECTION_INITIALIZATION\n<script>\n// Set up the loan traces buttons.\ndocument.querySelectorAll(\".traces button\").forEach(button => {\n button.addEventListener(\"click\", e => {\n // We remove the class hiding the trace by default.\n let loan = button.getAttribute(\"data-loan\");\n let trace = document.getElementById(`trace-${loan}`);\n trace.classList.remove(\"hidden\");\n\n // And we also remove the button\'s container.\n button.parentElement.remove();\n });\n});\n</script>\n</body>\n</html>\n";Expand description
The polonius MIR dump template: a regular HTML file for easy editing, with special dummy sections to be replaced by real contents.