mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-25 19:35:06 +00:00
22 lines
No EOL
6.2 KiB
HTML
22 lines
No EOL
6.2 KiB
HTML
<!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-Regular-0fe48ade.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" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.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.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><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="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>ide_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-979">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="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Diagnostic.html" title="struct ide_diagnostics::Diagnostic">Diagnostic</a></div></li><li><div class="item-name"><a class="struct" href="struct.DiagnosticsConfig.html" title="struct ide_diagnostics::DiagnosticsConfig">Diagnostics<wbr>Config</a></div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.DiagnosticCode.html" title="enum ide_diagnostics::DiagnosticCode">Diagnostic<wbr>Code</a></div></li><li><div class="item-name"><a class="enum" href="enum.ExprFillDefaultMode.html" title="enum ide_diagnostics::ExprFillDefaultMode">Expr<wbr>Fill<wbr>Default<wbr>Mode</a></div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.full_diagnostics.html" title="fn ide_diagnostics::full_diagnostics">full_<wbr>diagnostics</a></div><div class="desc docblock-short">Request both syntax and semantic diagnostics for the given [<code>FileId</code>].</div></li><li><div class="item-name"><a class="fn" href="fn.semantic_diagnostics.html" title="fn ide_diagnostics::semantic_diagnostics">semantic_<wbr>diagnostics</a></div><div class="desc docblock-short">Request semantic diagnostics for the given [<code>FileId</code>]. The produced diagnostics may point to other files
|
||
due to macros.</div></li><li><div class="item-name"><a class="fn" href="fn.syntax_diagnostics.html" title="fn ide_diagnostics::syntax_diagnostics">syntax_<wbr>diagnostics</a></div><div class="desc docblock-short">Request parser level diagnostics for the given [<code>FileId</code>].</div></li></ul></section></div></main></body></html> |