| <!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="This module implements a reference search. First, the element at the cursor position must be either an `ast::Name` or `ast::NameRef`. If it’s an `ast::NameRef`, at the classification step we try to resolve the direct tree parent of this element, otherwise we already have a definition and just need to get its HIR together with some information that is needed for further steps of searching. After that, we collect files that might contain references and look for text occurrences of the identifier. If there’s an `ast::NameRef` at the index that the match starts at and its tree parent is resolved to the search element definition, we get a reference."><title>ide::references - 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-b7b9f40b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="ide" data-themes="" data-resource-suffix="" data-rustdoc-version="1.95.0 (59807616e 2026-04-14)" data-channel="1.95.0" data-search-js="search-63369b7b.js" data-stringdex-js="stringdex-b897f86f.js" data-settings-js="settings-170eb4bf.js" ><script src="../../static.files/storage-41dd4d93.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5013f961.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"><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="#">Module references</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../ide/index.html">ide</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module references</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate ide</a></h2></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"><div class="rustdoc-breadcrumbs"><a href="../index.html">ide</a></div><h1>Module <span>references</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/references.rs.html#1-3186">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This module implements a reference search. |
| First, the element at the cursor position must be either an <code>ast::Name</code> |
| or <code>ast::NameRef</code>. If it’s an <code>ast::NameRef</code>, at the classification step we |
| try to resolve the direct tree parent of this element, otherwise we |
| already have a definition and just need to get its HIR together with |
| some information that is needed for further steps of searching. |
| After that, we collect files that might contain references and look |
| for text occurrences of the identifier. If there’s an <code>ast::NameRef</code> |
| at the index that the match starts at and its tree parent is |
| resolved to the search element definition, we get a reference.</p> |
| <p>Special handling for constructors/initializations: |
| When searching for references to a struct/enum/variant, if the cursor is positioned on:</p> |
| <ul> |
| <li><code>{</code> after a struct/enum/variant definition</li> |
| <li><code>(</code> for tuple structs/variants</li> |
| <li><code>;</code> for unit structs</li> |
| <li>The type name in a struct/enum/variant definition |
| Then only constructor/initialization usages will be shown, filtering out other references.</li> |
| </ul> |
| </div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Declaration.html" title="struct ide::references::Declaration">Declaration</a></dt><dd>Information about the declaration site of a searched item.</dd><dt><a class="struct" href="struct.FindAllRefsConfig.html" title="struct ide::references::FindAllRefsConfig">Find<wbr>AllRefs<wbr>Config</a></dt><dt><a class="struct" href="struct.ReferenceSearchResult.html" title="struct ide::references::ReferenceSearchResult">Reference<wbr>Search<wbr>Result</a></dt><dd>Result of a reference search operation.</dd></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.find_all_refs.html" title="fn ide::references::find_all_refs">find_<wbr>all_<wbr>refs</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Find all references to the item at the given position.</dd><dt><a class="fn" href="fn.find_defs.html" title="fn ide::references::find_defs">find_<wbr>defs</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.handle_control_flow_keywords.html" title="fn ide::references::handle_control_flow_keywords">handle_<wbr>control_<wbr>flow_<wbr>keywords</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.is_enum_lit_name_ref.html" title="fn ide::references::is_enum_lit_name_ref">is_<wbr>enum_<wbr>lit_<wbr>name_<wbr>ref</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Checks if a name reference is part of an enum variant literal expression. |
| Used to filter references when searching for enum variant constructors.</dd><dt><a class="fn" href="fn.is_lit_name_ref.html" title="fn ide::references::is_lit_name_ref">is_<wbr>lit_<wbr>name_<wbr>ref</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Checks if a name reference is used in a literal (constructor) context. |
| Used to filter references when searching for struct/variant constructors.</dd><dt><a class="fn" href="fn.name_for_constructor_search.html" title="fn ide::references::name_for_constructor_search">name_<wbr>for_<wbr>constructor_<wbr>search</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Returns <code>Some</code> if the cursor is at a position where we should search for constructor/initialization usages. |
| This is used to implement the special constructor search behavior when the cursor is on specific tokens |
| in a struct/enum/variant definition.</dd><dt><a class="fn" href="fn.path_ends_with.html" title="fn ide::references::path_ends_with">path_<wbr>ends_<wbr>with</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Checks if a path ends with the given name reference. |
| Helper function for checking constructor usage patterns.</dd><dt><a class="fn" href="fn.retain_adt_literal_usages.html" title="fn ide::references::retain_adt_literal_usages">retain_<wbr>adt_<wbr>literal_<wbr>usages</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Filter out all non-literal usages for adt-defs</dd></dl></section></div></main></body></html> |