| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Diagnostics rendering and fixits."><title>ide_diagnostics - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-1ed95124.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="ide_diagnostics" data-themes="" data-resource-suffix="" data-rustdoc-version="1.98.0 (88d9e12ae 2026-08-18)" data-channel="1.98.0" data-search-js="search-9944d736.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../static.files/storage-41dd4d93.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-417ebf0a.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate ide_diagnostics</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../ide_diagnostics/index.html">ide_<wbr>diagnostics</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#statics" title="Statics">Statics</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><h1>Crate <span>ide_<wbr>diagnostics</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/ide_diagnostics/lib.rs.html#1-861">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Diagnostics rendering and fixits.</p> |
| <p>Most of the diagnostics originate from the dark depth of the compiler, and |
| are originally expressed in term of IR. When we emit the diagnostic, we are |
| usually not in the position to decide how to best “render” it in terms of |
| user-authored source code. We are especially not in the position to offer |
| fixits, as the compiler completely lacks the infrastructure to edit the |
| source code.</p> |
| <p>Instead, we “bubble up” raw, structured diagnostics until the <code>hir</code> crate, |
| where we “cook” them so that each diagnostic is formulated in terms of <code>hir</code> |
| types. Well, at least that’s the aspiration, the “cooking” is somewhat |
| ad-hoc at the moment. Anyways, we get a bunch of ide-friendly diagnostic |
| structs from hir, and we want to render them to unified serializable |
| representation (span, level, message) here. If we can, we also provide |
| fixits. By the way, that’s why we want to keep diagnostics structured |
| internally – so that we have all the info to make fixes.</p> |
| <p>We have one “handler” module per diagnostic code. Such a module contains |
| rendering, optional fixes and tests. It’s OK if some low-level compiler |
| functionality ends up being tested via a diagnostic.</p> |
| <p>There are also a couple of ad-hoc diagnostics implemented directly here, we |
| don’t yet have a great pattern for how to do them properly.</p> |
| </div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="handlers/index.html" title="mod ide_diagnostics::handlers">handlers</a><span title="Restricted Visibility"> 🔒</span> </dt></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BuiltLint.html" title="struct ide_diagnostics::BuiltLint">Built<wbr>Lint</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="struct" href="struct.Diagnostic.html" title="struct ide_diagnostics::Diagnostic">Diagnostic</a></dt><dt><a class="struct" href="struct.DiagnosticsConfig.html" title="struct ide_diagnostics::DiagnosticsConfig">Diagnostics<wbr>Config</a></dt><dt><a class="struct" href="struct.DiagnosticsContext.html" title="struct ide_diagnostics::DiagnosticsContext">Diagnostics<wbr>Context</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="struct" href="struct.LintGroups.html" title="struct ide_diagnostics::LintGroups">Lint<wbr>Groups</a><span title="Restricted Visibility"> 🔒</span> </dt></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.DiagnosticCode.html" title="enum ide_diagnostics::DiagnosticCode">Diagnostic<wbr>Code</a></dt></dl><h2 id="statics" class="section-header">Statics<a href="#statics" class="anchor">§</a></h2><dl class="item-table"><dt><a class="static" href="static.CLIPPY_LINTS.html" title="static ide_diagnostics::CLIPPY_LINTS">CLIPPY_<wbr>LINTS</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="static" href="static.LINTS_TO_REPORT_IN_EXTERNAL_MACROS.html" title="static ide_diagnostics::LINTS_TO_REPORT_IN_EXTERNAL_MACROS">LINTS_<wbr>TO_<wbr>REPORT_<wbr>IN_<wbr>EXTERNAL_<wbr>MACROS</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="static" href="static.RUSTC_LINTS.html" title="static ide_diagnostics::RUSTC_LINTS">RUSTC_<wbr>LINTS</a><span title="Restricted Visibility"> 🔒</span> </dt></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.adjusted_display_range.html" title="fn ide_diagnostics::adjusted_display_range">adjusted_<wbr>display_<wbr>range</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.build_lints_map.html" title="fn ide_diagnostics::build_lints_map">build_<wbr>lints_<wbr>map</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.default_lint_severity.html" title="fn ide_diagnostics::default_lint_severity">default_<wbr>lint_<wbr>severity</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.find_outline_mod_lint_severity.html" title="fn ide_diagnostics::find_outline_mod_lint_severity">find_<wbr>outline_<wbr>mod_<wbr>lint_<wbr>severity</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.fix.html" title="fn ide_diagnostics::fix">fix</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.full_diagnostics.html" title="fn ide_diagnostics::full_diagnostics">full_<wbr>diagnostics</a></dt><dd>Request both syntax and semantic diagnostics for the given [<code>FileId</code>].</dd><dt><a class="fn" href="fn.handle_diag_from_macros.html" title="fn ide_diagnostics::handle_diag_from_macros">handle_<wbr>diag_<wbr>from_<wbr>macros</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Returns whether to keep this diagnostic (or remove it).</dd><dt><a class="fn" href="fn.handle_lints.html" title="fn ide_diagnostics::handle_lints">handle_<wbr>lints</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.lint_attrs.html" title="fn ide_diagnostics::lint_attrs">lint_<wbr>attrs</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.lint_groups.html" title="fn ide_diagnostics::lint_groups">lint_<wbr>groups</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.lint_severity_at.html" title="fn ide_diagnostics::lint_severity_at">lint_<wbr>severity_<wbr>at</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.semantic_diagnostics.html" title="fn ide_diagnostics::semantic_diagnostics">semantic_<wbr>diagnostics</a></dt><dd>Request semantic diagnostics for the given [<code>FileId</code>]. The produced diagnostics may point to other files |
| due to macros.</dd><dt><a class="fn" href="fn.syntax_diagnostics.html" title="fn ide_diagnostics::syntax_diagnostics">syntax_<wbr>diagnostics</a></dt><dd>Request parser level diagnostics for the given [<code>FileId</code>].</dd><dt><a class="fn" href="fn.unresolved_fix.html" title="fn ide_diagnostics::unresolved_fix">unresolved_<wbr>fix</a><span title="Restricted Visibility"> 🔒</span> </dt></dl></section></div></main></body></html> |