repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/intern/src/intern.rs | src/tools/rust-analyzer/crates/intern/src/intern.rs | //! Interning of single values.
//!
//! Interning supports two modes: GC and non-GC.
//!
//! In non-GC mode, you create [`Interned`]s, and can create `Copy` handles to them
//! that can still be upgraded back to [`Interned`] ([`InternedRef`]) via [`Interned::as_ref`].
//! Generally, letting the [`InternedRef`] to outli... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/intern/src/symbol.rs | src/tools/rust-analyzer/crates/intern/src/symbol.rs | //! Attempt at flexible symbol interning, allowing to intern and free strings at runtime while also
//! supporting compile time declaration of symbols that will never be freed.
use std::{
fmt,
hash::{BuildHasher, BuildHasherDefault, Hash},
mem::{self, ManuallyDrop},
ptr::NonNull,
sync::OnceLock,
};... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs | src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs | //! Module defining all known symbols required by the rest of rust-analyzer.
#![allow(non_upper_case_globals)]
use std::hash::{BuildHasher, BuildHasherDefault};
use dashmap::{DashMap, SharedValue};
use rustc_hash::FxHasher;
use crate::{Symbol, symbol::TaggedArcPtr};
macro_rules! define_symbols {
(@WITH_NAME: $(... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs | src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs | //! An implementation of `loader::Handle`, based on `walkdir` and `notify`.
//!
//! The file watching bits here are untested and quite probably buggy. For this
//! reason, by default we don't watch files and rely on editor's file watching
//! capabilities.
//!
//! Hopefully, one day a reliable file watching/walking cra... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs | src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs | //! Conversions between [`SyntaxNode`] and [`tt::TokenTree`].
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;
use std::{collections::VecDeque, fmt, hash::Hash};
use intern::Symbol;
use rustc_hash::{FxHashMap, FxHashSet};
use span::{Edit... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/syntax-bridge/src/tests.rs | src/tools/rust-analyzer/crates/syntax-bridge/src/tests.rs | use rustc_hash::FxHashMap;
use span::Span;
use syntax::{AstNode, ast};
use test_utils::extract_annotations;
use tt::{Leaf, Punct, Spacing, buffer::Cursor};
use crate::{
DocCommentDesugarMode,
dummy_test_span_utils::{DUMMY, DummyTestSpanMap},
syntax_node_to_token_tree,
};
fn check_punct_spacing(fixture: &s... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs | src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs | //! Utilities for formatting macro expanded nodes until we get a proper formatter.
use syntax::{
NodeOrToken,
SyntaxKind::{self, *},
SyntaxNode, SyntaxToken, T, WalkEvent,
ast::make,
ted::{self, Position},
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PrettifyWsKind {
Space,
Inde... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/syntax-bridge/src/to_parser_input.rs | src/tools/rust-analyzer/crates/syntax-bridge/src/to_parser_input.rs | //! Convert macro-by-example tokens which are specific to macro expansion into a
//! format that works for our parser.
use rustc_hash::FxHashMap;
use span::{Edition, SyntaxContext};
use syntax::{SyntaxKind, SyntaxKind::*, T};
pub fn to_parser_input(
buffer: tt::TokenTreesView<'_>,
span_to_edition: &mut dyn Fn... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/macros/src/lib.rs | src/tools/rust-analyzer/crates/macros/src/lib.rs | //! Proc macros for rust-analyzer.
use quote::{ToTokens, quote};
use syn::parse_quote;
use synstructure::decl_derive;
decl_derive!(
[TypeFoldable, attributes(type_foldable)] =>
/// Derives `TypeFoldable` for the annotated `struct` or `enum` (`union` is not supported).
///
/// The fold will produce a v... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/replacing.rs | src/tools/rust-analyzer/crates/ide-ssr/src/replacing.rs | //! Code for applying replacement templates for matches that have previously been found.
use ide_db::text_edit::TextEdit;
use ide_db::{FxHashMap, FxHashSet};
use itertools::Itertools;
use parser::Edition;
use syntax::{
SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize,
ast::{self, AstNode... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/errors.rs | src/tools/rust-analyzer/crates/ide-ssr/src/errors.rs | //! Code relating to errors produced by SSR.
/// Constructs an SsrError taking arguments like the format macro.
macro_rules! _error {
($fmt:expr) => {$crate::SsrError::new(format!($fmt))};
($fmt:expr, $($arg:tt)+) => {$crate::SsrError::new(format!($fmt, $($arg)+))}
}
pub(crate) use _error as error;
/// Return... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/lib.rs | src/tools/rust-analyzer/crates/ide-ssr/src/lib.rs | //! Structural Search Replace
//!
//! Allows searching the AST for code that matches one or more patterns and then replacing that code
//! based on a template.
// Feature: Structural Search and Replace
//
// Search and replace with named wildcards that will match any expression, type, path, pattern or item.
// The syn... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/tests.rs | src/tools/rust-analyzer/crates/ide-ssr/src/tests.rs | use expect_test::{Expect, expect};
use hir::{FilePosition, FileRange};
use ide_db::{
EditionedFileId, FxHashSet, LocalRoots,
base_db::{SourceDatabase, salsa::Setter},
};
use test_utils::RangeOrOffset;
use crate::{MatchFinder, SsrRule};
fn parse_error_text(query: &str) -> String {
format!("{}", query.parse... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/nester.rs | src/tools/rust-analyzer/crates/ide-ssr/src/nester.rs | //! Converts a flat collection of matches into a nested form suitable for replacement. When there
//! are multiple matches for a node, or that overlap, priority is given to the earlier rule. Nested
//! matches are only permitted if the inner match is contained entirely within a placeholder of an
//! outer match.
//!
//... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/matching.rs | src/tools/rust-analyzer/crates/ide-ssr/src/matching.rs | //! This module is responsible for matching a search pattern against a node in the AST. In the
//! process of matching, placeholder values are recorded.
use crate::{
SsrMatches,
parsing::{Constraint, NodeKind, Placeholder, Var},
resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo},
};
use hir::{FileRan... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/from_comment.rs | src/tools/rust-analyzer/crates/ide-ssr/src/from_comment.rs | //! This module allows building an SSR MatchFinder by parsing the SSR rule
//! from a comment.
use ide_db::{EditionedFileId, FilePosition, FileRange, RootDatabase, base_db::RootQueryDb};
use syntax::{
TextRange,
ast::{self, AstNode, AstToken},
};
use crate::MatchFinder;
/// Attempts to build an SSR MatchFind... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/search.rs | src/tools/rust-analyzer/crates/ide-ssr/src/search.rs | //! Searching for matches.
use crate::{
Match, MatchFinder, matching,
resolving::{ResolvedPath, ResolvedPattern, ResolvedRule},
};
use hir::FileRange;
use ide_db::{
FileId, FxHashSet, LocalRoots,
defs::Definition,
search::{SearchScope, UsageSearchResult},
};
use syntax::{AstNode, SyntaxKind, Syntax... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/resolving.rs | src/tools/rust-analyzer/crates/ide-ssr/src/resolving.rs | //! This module is responsible for resolving paths within rules.
use hir::AsAssocItem;
use ide_db::FxHashMap;
use parsing::Placeholder;
use syntax::{
SmolStr, SyntaxKind, SyntaxNode, SyntaxToken,
ast::{self, HasGenericArgs},
};
use crate::{SsrError, errors::error, parsing};
pub(crate) struct ResolutionScope<... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/parsing.rs | src/tools/rust-analyzer/crates/ide-ssr/src/parsing.rs | //! This file contains code for parsing SSR rules, which look something like `foo($a) ==>> bar($b)`.
//! We first split everything before and after the separator `==>>`. Next, both the search pattern
//! and the replacement template get tokenized by the Rust tokenizer. Tokens are then searched for
//! placeholders, whi... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-ssr/src/fragments.rs | src/tools/rust-analyzer/crates/ide-ssr/src/fragments.rs | //! When specifying SSR rule, you generally want to map one *kind* of thing to
//! the same kind of thing: path to path, expression to expression, type to
//! type.
//!
//! The problem is, while this *kind* is generally obvious to the human, the ide
//! needs to determine it somehow. We do this in a stupid way -- by pa... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/config.rs | src/tools/rust-analyzer/crates/ide-completion/src/config.rs | //! Settings for tweaking completion.
//!
//! The fun thing here is `SnippetCap` -- this type can only be created in this
//! module, and we use to statically check that we only produce snippet
//! completions if we are allowed to.
use hir::FindPathConfig;
use ide_db::{
MiniCore, SnippetCap,
imports::{import_a... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/lib.rs | src/tools/rust-analyzer/crates/ide-completion/src/lib.rs | //! `completions` crate provides utilities for generating completions of user input.
// It's useful to refer to code that is private in doc comments.
#![allow(rustdoc::private_intra_doc_links)]
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests.rs | //! Tests and test utilities for completions.
//!
//! Most tests live in this module or its submodules. The tests in these submodules are "location"
//! oriented, that is they try to check completions for something like type position, param position
//! etc.
//! Tests that are more orientated towards specific completio... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/snippet.rs | src/tools/rust-analyzer/crates/ide-completion/src/snippet.rs | //! User (postfix)-snippet definitions.
//!
//! Actual logic is implemented in [`crate::completions::postfix`] and [`crate::completions::snippet`] respectively.
// Feature: User Snippet Completions
//
// rust-analyzer allows the user to define custom (postfix)-snippets that may depend on items to be accessible for the... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render.rs | src/tools/rust-analyzer/crates/ide-completion/src/render.rs | //! `render` module provides utilities for rendering completion suggestions
//! into code pieces that will be presented to user.
pub(crate) mod const_;
pub(crate) mod function;
pub(crate) mod literal;
pub(crate) mod macro_;
pub(crate) mod pattern;
pub(crate) mod type_alias;
pub(crate) mod union_literal;
pub(crate) mod... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions.rs | //! This module defines an accumulator for completions which are going to be presented to user.
pub(crate) mod attribute;
pub(crate) mod dot;
pub(crate) mod env_vars;
pub(crate) mod expr;
pub(crate) mod extern_abi;
pub(crate) mod extern_crate;
pub(crate) mod field;
pub(crate) mod flyimport;
pub(crate) mod fn_param;
pu... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/item.rs | src/tools/rust-analyzer/crates/ide-completion/src/item.rs | //! See `CompletionItem` structure.
use std::{fmt, mem};
use hir::Mutability;
use ide_db::text_edit::TextEdit;
use ide_db::{
RootDatabase, SnippetCap, SymbolKind, documentation::Documentation,
imports::import_assets::LocatedImport,
};
use itertools::Itertools;
use macros::UpmapFromRaFixture;
use smallvec::Sma... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/context.rs | src/tools/rust-analyzer/crates/ide-completion/src/context.rs | //! See [`CompletionContext`] structure.
mod analysis;
#[cfg(test)]
mod tests;
use std::iter;
use base_db::RootQueryDb as _;
use hir::{
DisplayTarget, HasAttrs, InFile, Local, ModuleDef, ModuleSource, Name, PathResolution,
ScopeDef, Semantics, SemanticsScope, Symbol, Type, TypeInfo,
};
use ide_db::{
File... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/attribute.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/attribute.rs | //! Completion tests for attributes.
use expect_test::expect;
use crate::tests::{check, check_edit};
#[test]
fn derive_helpers() {
check(
r#"
//- /mac.rs crate:mac
#![crate_type = "proc-macro"]
#[proc_macro_derive(MyDerive, attributes(my_cool_helper_attribute))]
pub fn my_derive() {}
//- /lib.rs crate:l... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/visibility.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/visibility.rs | //! Completion tests for visibility modifiers.
use expect_test::expect;
use crate::tests::{check, check_with_private_editable, check_with_trigger_character};
#[test]
fn empty_pub() {
cov_mark::check!(kw_completion_in);
check_with_trigger_character(
r#"
pub($0)
"#,
Some('('),
expect![[r... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/fn_param.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/fn_param.rs | use expect_test::expect;
use crate::tests::{check, check_with_trigger_character};
#[test]
fn only_param() {
check(
r#"
fn foo(file_id: usize) {}
fn bar(file_id: usize) {}
fn baz(file$0) {}
"#,
expect![[r#"
bn file_id: usize
kw mut
kw ref
"#]],
);
}
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/type_pos.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/type_pos.rs | //! Completion tests for type position.
use expect_test::expect;
use crate::tests::{check, check_with_base_items};
#[test]
fn record_field_ty() {
check_with_base_items(
r#"
struct Foo<'lt, T, const C: usize> {
f: $0
}
"#,
expect![[r#"
en Enum Enum
ma ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/raw_identifiers.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/raw_identifiers.rs | use base_db::SourceDatabase;
use expect_test::{Expect, expect};
use itertools::Itertools;
use crate::tests::{TEST_CONFIG, completion_list_with_config_raw, position};
fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) {
let completions = completion_list_with_config_raw(TEST_CONFIG, ra_fixtur... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/pattern.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/pattern.rs | //! Completion tests for pattern position.
use expect_test::expect;
use crate::tests::{check, check_edit, check_with_base_items};
#[test]
fn wildcard() {
check_with_base_items(
r#"
fn quux() {
let _$0
}
"#,
expect![""],
);
}
#[test]
fn ident_rebind_pat() {
check(
r#"
fn quux()... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/proc_macros.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/proc_macros.rs | //! Completion tests for expressions.
use expect_test::expect;
use crate::tests::check;
#[test]
fn complete_dot_in_attr() {
check(
r#"
//- proc_macros: identity
pub struct Foo;
impl Foo {
fn foo(&self) {}
}
#[proc_macros::identity]
fn main() {
Foo.$0
}
"#,
expect![[r#"
me foo(... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/use_tree.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/use_tree.rs | //! Completion tests for use trees.
use expect_test::expect;
use crate::tests::check;
#[test]
fn use_tree_completion() {
check(
r#"
struct implThing;
use crate::{impl$0};
"#,
expect![[r#"
st implThing implThing
kw self
"#]],
);
check(
r#"
struct im... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/item_list.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/item_list.rs | //! Completion tests for item list position.
use expect_test::expect;
use crate::tests::{check, check_edit, check_with_base_items};
#[test]
fn in_mod_item_list() {
check_with_base_items(
r#"mod tests { $0 }"#,
expect![[r#"
ma makro!(…) macro_rules! makro
kw async
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/predicate.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/predicate.rs | //! Completion tests for predicates and bounds.
use expect_test::expect;
use crate::tests::{check, check_with_base_items};
#[test]
fn predicate_start() {
// FIXME: `for` kw
check_with_base_items(
r#"
struct Foo<'lt, T, const C: usize> where $0 {}
"#,
expect![[r#"
en Enum ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/expression.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/expression.rs | //! Completion tests for expressions.
use expect_test::{Expect, expect};
use crate::{
CompletionConfig,
config::AutoImportExclusionType,
tests::{
BASE_ITEMS_FIXTURE, TEST_CONFIG, check, check_edit, check_with_base_items,
completion_list_with_config,
},
};
fn check_with_config(
conf... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/flyimport.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/flyimport.rs | use expect_test::{Expect, expect};
use crate::{
CompletionConfig,
context::{CompletionAnalysis, NameContext, NameKind, NameRefKind},
tests::{TEST_CONFIG, check_edit, check_edit_with_config},
};
fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) {
check_with_config(TEST_CONFIG, r... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/record.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/record.rs | use expect_test::expect;
use crate::tests::check;
use super::check_edit;
#[test]
fn without_default_impl() {
check(
r#"
struct Struct { foo: u32, bar: usize }
fn foo() {
let other = Struct {
foo: 5,
$0
};
}
"#,
expect![[r#"
fd bar usize
"#]],
);
}
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/special.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/special.rs | //! Tests that don't fit into a specific category.
use expect_test::{Expect, expect};
use ide_db::SymbolKind;
use crate::{
CompletionItemKind,
tests::{
TEST_CONFIG, check, check_edit, check_no_kw, check_with_trigger_character,
do_completion_with_config,
},
};
#[test]
fn completes_if_prefi... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/tests/item.rs | src/tools/rust-analyzer/crates/ide-completion/src/tests/item.rs | //! Completion tests for item specifics overall.
//!
//! Except for use items which are tested in [super::use_tree] and mod declarations with are tested
//! in [crate::completions::mod_].
use expect_test::expect;
use crate::tests::{check, check_edit, check_with_base_items};
#[test]
fn target_type_or_trait_in_impl_blo... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/mod_.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/mod_.rs | //! Completes mod declarations.
use std::iter;
use hir::Module;
use ide_db::{
FxHashSet, RootDatabase, SymbolKind,
base_db::{SourceDatabase, VfsPath},
};
use syntax::{AstNode, SyntaxKind, ast};
use crate::{CompletionItem, Completions, context::CompletionContext};
/// Complete mod declaration, i.e. `mod $0;`... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute.rs | //! Completion for (built-in) attributes, derives and lints.
//!
//! This module uses a bit of static metadata to provide completions for builtin-in attributes and lints.
use std::sync::LazyLock;
use ide_db::{
FxHashMap, SymbolKind,
generated::lints::{
CLIPPY_LINT_GROUPS, CLIPPY_LINTS, DEFAULT_LINTS, ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/ra_fixture.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/ra_fixture.rs | //! Injected completions for `#[rust_analyzer::rust_fixture]`.
use hir::FilePositionWrapper;
use ide_db::{
impl_empty_upmap_from_ra_fixture,
ra_fixture::{RaFixtureAnalysis, UpmapFromRaFixture},
};
use syntax::ast;
use crate::{
CompletionItemKind, CompletionItemRefMode, CompletionRelevance, completions::Co... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/lifetime.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/lifetime.rs | //! Completes lifetimes and labels.
//!
//! These completions work a bit differently in that they are only shown when what the user types
//! has a `'` preceding it, as our fake syntax tree is invalid otherwise (due to us not inserting
//! a lifetime but an ident for obvious reasons).
//! Due to this all the tests for ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/field.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/field.rs | //! Completion of field list position.
use crate::{
CompletionContext, Completions,
context::{PathCompletionCtx, Qualified},
};
pub(crate) fn complete_field_list_tuple_variant(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
path_ctx: &PathCompletionCtx<'_>,
) {
if ctx.qualifier_ctx.vis_no... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/use_.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/use_.rs | //! Completion for use trees
use hir::ScopeDef;
use ide_db::{FxHashSet, SymbolKind};
use syntax::{AstNode, ast, format_smolstr};
use crate::{
CompletionItem, CompletionItemKind, CompletionRelevance, Completions,
context::{CompletionContext, PathCompletionCtx, Qualified},
item::Builder,
};
pub(crate) fn c... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs | //! Completion of names from the current scope in expression position.
use std::ops::ControlFlow;
use hir::{Complete, Name, PathCandidateCallback, ScopeDef, sym};
use ide_db::FxHashSet;
use syntax::ast;
use crate::{
CompletionContext, Completions,
completions::record::add_default_update,
context::{PathCo... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/fn_param.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/fn_param.rs | //! See [`complete_fn_param`].
use hir::HirDisplay;
use ide_db::FxHashMap;
use itertools::Either;
use syntax::{
AstNode, Direction, SyntaxKind, TextRange, TextSize, algo,
ast::{self, HasModuleItem},
match_ast,
};
use crate::{
CompletionContext, CompletionItem, CompletionItemKind, Completions,
cont... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/extern_crate.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/extern_crate.rs | //! Completion for extern crates
use hir::Name;
use ide_db::{SymbolKind, documentation::HasDocs};
use syntax::ToSmolStr;
use crate::{CompletionItem, CompletionItemKind, context::CompletionContext};
use super::Completions;
pub(crate) fn complete_extern_crate(acc: &mut Completions, ctx: &CompletionContext<'_>) {
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/pattern.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/pattern.rs | //! Completes constants and paths in unqualified patterns.
use hir::{AssocItem, ScopeDef};
use ide_db::syntax_helpers::suggest_name;
use syntax::ast::Pat;
use crate::{
CompletionContext, Completions,
context::{PathCompletionCtx, PatternContext, PatternRefutability, Qualified},
};
/// Completes constants and ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs | //! Postfix completions, like `Ok(10).ifl$0` => `if let Ok() = Ok(10) { $0 }`.
mod format_like;
use base_db::SourceDatabase;
use hir::{ItemInNs, Semantics};
use ide_db::{
RootDatabase, SnippetCap,
documentation::{Documentation, HasDocs},
imports::insert_use::ImportScope,
syntax_helpers::suggest_name::... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/format_string.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/format_string.rs | //! Completes identifiers in format string literals.
use hir::{ModuleDef, ScopeDef};
use ide_db::{SymbolKind, syntax_helpers::format_string::is_format_string};
use itertools::Itertools;
use syntax::{AstToken, TextRange, TextSize, ToSmolStr, ast};
use crate::{CompletionItem, CompletionItemKind, Completions, context::C... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/vis.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/vis.rs | //! Completion for visibility specifiers.
use crate::{
Completions,
context::{CompletionContext, PathCompletionCtx, Qualified},
};
pub(crate) fn complete_vis_path(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
path_ctx @ PathCompletionCtx { qualified, .. }: &PathCompletionCtx<'_>,
&has_i... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/snippet.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/snippet.rs | //! This file provides snippet completions, like `pd` => `eprintln!(...)`.
use ide_db::{SnippetCap, documentation::Documentation, imports::insert_use::ImportScope};
use crate::{
CompletionContext, CompletionItem, CompletionItemKind, Completions, SnippetScope,
context::{ItemListKind, PathCompletionCtx, PathExp... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/extern_abi.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/extern_abi.rs | //! Completes function abi strings.
use syntax::{
AstNode, AstToken, SmolStr,
ast::{self, IsString},
};
use crate::{
CompletionItem, CompletionItemKind, completions::Completions, context::CompletionContext,
};
// Most of these are feature gated, we should filter/add feature gate completions once we have t... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list.rs | //! Completion of paths and keywords at item list position.
use crate::{
CompletionContext, Completions,
context::{ItemListKind, PathCompletionCtx, PathExprCtx, Qualified},
};
pub(crate) mod trait_impl;
pub(crate) fn complete_item_list_in_expr(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/keyword.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/keyword.rs | //! Completes `where` and `for` keywords.
use syntax::ast::{self, Item};
use crate::{CompletionContext, Completions};
pub(crate) fn complete_for_and_where(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
keyword_item: &ast::Item,
) {
let mut add_keyword = |kw, snippet| acc.add_keyword_snippet(ctx... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs | //! Completion of names from the current scope in type position.
use hir::{HirDisplay, ScopeDef};
use syntax::{AstNode, ast};
use crate::{
CompletionContext, Completions,
context::{PathCompletionCtx, Qualified, TypeAscriptionTarget, TypeLocation},
render::render_type_inference,
};
pub(crate) fn complete_... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/macro_def.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/macro_def.rs | //! Completion for macro meta-variable segments
use ide_db::SymbolKind;
use crate::{CompletionItem, Completions, context::CompletionContext};
pub(crate) fn complete_macro_segment(acc: &mut Completions, ctx: &CompletionContext<'_>) {
for &label in MACRO_SEGMENTS {
let item =
CompletionItem::ne... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/flyimport.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/flyimport.rs | //! See [`import_on_the_fly`].
use hir::{ItemInNs, ModuleDef};
use ide_db::imports::{
import_assets::{ImportAssets, LocatedImport},
insert_use::ImportScope,
};
use itertools::Itertools;
use syntax::{AstNode, SyntaxNode, ast};
use crate::{
Completions,
config::AutoImportExclusionType,
context::{
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/record.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/record.rs | //! Complete fields in record literals and patterns.
use ide_db::SymbolKind;
use syntax::{
SmolStr,
ast::{self, Expr},
};
use crate::{
CompletionContext, CompletionItem, CompletionItemKind, CompletionRelevance,
CompletionRelevancePostfixMatch, Completions,
context::{DotAccess, DotAccessExprCtx, Dot... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/dot.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/dot.rs | //! Completes references after dot (fields and method calls).
use std::ops::ControlFlow;
use hir::{Complete, Function, HasContainer, ItemContainer, MethodCandidateCallback};
use ide_db::FxHashSet;
use itertools::Either;
use syntax::SmolStr;
use crate::{
CompletionItem, CompletionItemKind, Completions,
contex... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/env_vars.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/env_vars.rs | //! Completes environment variables defined by Cargo
//! (<https://doc.rust-lang.org/cargo/reference/environment-variables.html>)
use ide_db::syntax_helpers::node_ext::macro_call_for_string_token;
use syntax::{
AstToken,
ast::{self, IsString},
};
use crate::{
CompletionItem, CompletionItemKind, completions... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix/format_like.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix/format_like.rs | // Feature: Format String Completion
//
// `"Result {result} is {2 + 2}"` is expanded to the `"Result {} is {}", result, 2 + 2`.
//
// The following postfix snippets are available:
//
// * `format` -> `format!(...)`
// * `panic` -> `panic!(...)`
// * `println` -> `println!(...)`
// * `log`:
// ** `logd` -> `log::debug!... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list/trait_impl.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list/trait_impl.rs | //! Completion for associated items in a trait implementation.
//!
//! This module adds the completion items related to implementing associated
//! items within an `impl Trait for Struct` block. The current context node
//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST` node
//! and an direct child of an `IMPL`... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/lint.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/lint.rs | //! Completion for lints
use ide_db::{SymbolKind, documentation::Documentation, generated::lints::Lint};
use syntax::ast;
use crate::{Completions, context::CompletionContext, item::CompletionItem};
pub(super) fn complete_lint(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
is_qualified: bool,
exi... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/derive.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/derive.rs | //! Completion for derives
use hir::ScopeDef;
use ide_db::{SymbolKind, documentation::HasDocs};
use itertools::Itertools;
use syntax::{SmolStr, ToSmolStr};
use crate::{
Completions,
context::{CompletionContext, ExistingDerives, PathCompletionCtx, Qualified},
item::CompletionItem,
};
pub(crate) fn complete... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/repr.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/repr.rs | //! Completion for representations.
use ide_db::SymbolKind;
use syntax::ast;
use crate::{Completions, context::CompletionContext, item::CompletionItem};
pub(super) fn complete_repr(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
input: ast::TokenTree,
) {
if let Some(existing_reprs) = super::par... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/cfg.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/cfg.rs | //! Completion for cfg
use ide_db::SymbolKind;
use itertools::Itertools;
use syntax::{AstToken, Direction, NodeOrToken, SmolStr, SyntaxKind, algo, ast::Ident};
use crate::{CompletionItem, completions::Completions, context::CompletionContext};
pub(crate) fn complete_cfg(acc: &mut Completions, ctx: &CompletionContext<... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/diagnostic.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/diagnostic.rs | //! Completion for diagnostic attributes.
use ide_db::SymbolKind;
use syntax::ast;
use crate::{CompletionItem, Completions, context::CompletionContext};
use super::AttrCompletion;
pub(super) fn complete_on_unimplemented(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
input: ast::TokenTree,
) {
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/macro_use.rs | src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/macro_use.rs | //! Completion for macros in `#[macro_use(...)]`
use hir::ModuleDef;
use ide_db::SymbolKind;
use syntax::ast;
use crate::{Completions, context::CompletionContext, item::CompletionItem};
pub(super) fn complete_macro_use(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
extern_crate: Option<&ast::ExternC... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs | src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs | //! Renderer for patterns.
use hir::{Name, StructKind, db::HirDatabase};
use ide_db::{SnippetCap, documentation::HasDocs};
use itertools::Itertools;
use syntax::{Edition, SmolStr, ToSmolStr};
use crate::{
CompletionItem, CompletionItemKind,
context::{ParamContext, ParamKind, PathCompletionCtx, PatternContext}... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs | src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs | //! Renderer for function calls.
use hir::{AsAssocItem, HirDisplay, db::HirDatabase};
use ide_db::{SnippetCap, SymbolKind};
use itertools::Itertools;
use stdx::{format_to, to_lower_snake_case};
use syntax::{AstNode, SmolStr, ToSmolStr, format_smolstr};
use crate::{
CallableSnippets,
context::{
Complet... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs | src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs | //! Renderer for `enum` variants.
use hir::{StructKind, db::HirDatabase};
use ide_db::{
SymbolKind,
documentation::{Documentation, HasDocs},
};
use crate::{
CompletionItemKind, CompletionRelevance, CompletionRelevanceReturnType,
context::{CompletionContext, PathCompletionCtx, PathKind},
item::{Bui... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render/union_literal.rs | src/tools/rust-analyzer/crates/ide-completion/src/render/union_literal.rs | //! Renderer for `union` literals.
use hir::{HirDisplay, Name, StructKind};
use ide_db::SymbolKind;
use itertools::Itertools;
use syntax::ToSmolStr;
use crate::{
CompletionItem, CompletionItemKind,
render::{
RenderContext,
variant::{format_literal_label, format_literal_lookup, visible_fields},... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render/type_alias.rs | src/tools/rust-analyzer/crates/ide-completion/src/render/type_alias.rs | //! Renderer for type aliases.
use hir::{AsAssocItem, HirDisplay};
use ide_db::SymbolKind;
use syntax::{SmolStr, ToSmolStr};
use crate::{item::CompletionItem, render::RenderContext};
pub(crate) fn render_type_alias(
ctx: RenderContext<'_>,
type_alias: hir::TypeAlias,
) -> Option<CompletionItem> {
let _p ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render/macro_.rs | src/tools/rust-analyzer/crates/ide-completion/src/render/macro_.rs | //! Renderer for macro invocations.
use hir::{HirDisplay, db::HirDatabase};
use ide_db::{SymbolKind, documentation::Documentation};
use syntax::{SmolStr, ToSmolStr, format_smolstr};
use crate::{
context::{PathCompletionCtx, PathKind, PatternContext},
item::{Builder, CompletionItem},
render::RenderContext,... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render/const_.rs | src/tools/rust-analyzer/crates/ide-completion/src/render/const_.rs | //! Renderer for `const` fields.
use hir::{AsAssocItem, HirDisplay};
use ide_db::SymbolKind;
use syntax::ToSmolStr;
use crate::{item::CompletionItem, render::RenderContext};
pub(crate) fn render_const(ctx: RenderContext<'_>, const_: hir::Const) -> Option<CompletionItem> {
let _p = tracing::info_span!("render_con... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/render/variant.rs | src/tools/rust-analyzer/crates/ide-completion/src/render/variant.rs | //! Code common to structs, unions, and enum variants.
use crate::context::CompletionContext;
use hir::{HasAttrs, HasCrate, HasVisibility, HirDisplay, StructKind};
use ide_db::SnippetCap;
use itertools::Itertools;
use syntax::SmolStr;
/// A rendered struct, union, or enum variant, split into fields for actual
/// aut... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/context/tests.rs | src/tools/rust-analyzer/crates/ide-completion/src/context/tests.rs | use expect_test::{Expect, expect};
use hir::HirDisplay;
use crate::{
context::CompletionContext,
tests::{TEST_CONFIG, position},
};
fn check_expected_type_and_name(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect) {
let (db, pos) = position(ra_fixture);
let config = TEST_CONFIG;
let... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs | src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs | //! Module responsible for analyzing the code surrounding the cursor for completion.
use std::iter;
use hir::{ExpandResult, InFile, Semantics, Type, TypeInfo, Variant};
use ide_db::{
RootDatabase, active_parameter::ActiveParameter, syntax_helpers::node_ext::find_loops,
};
use itertools::{Either, Itertools};
use st... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/db.rs | src/tools/rust-analyzer/crates/hir-ty/src/db.rs | //! The home of `HirDatabase`, which is the Salsa database containing all the
//! type inference-related queries.
use base_db::{Crate, target::TargetLoadError};
use either::Either;
use hir_def::{
AdtId, BuiltinDeriveImplId, CallableDefId, ConstId, ConstParamId, DefWithBodyId, EnumVariantId,
FunctionId, Generic... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/opaques.rs | src/tools/rust-analyzer/crates/hir-ty/src/opaques.rs | //! Handling of opaque types, detection of defining scope and hidden type.
use hir_def::{
AssocItemId, AssocItemLoc, DefWithBodyId, FunctionId, HasModule, ItemContainerId, TypeAliasId,
};
use hir_expand::name::Name;
use la_arena::ArenaMap;
use rustc_type_ir::inherent::Ty as _;
use syntax::ast;
use crate::{
Im... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir.rs | //! MIR definitions and implementation
use std::{collections::hash_map::Entry, fmt::Display, iter};
use base_db::Crate;
use either::Either;
use hir_def::{
DefWithBodyId, FieldId, StaticId, TupleFieldId, UnionId, VariantId,
expr_store::Body,
hir::{BindingAnnotation, BindingId, Expr, ExprId, Ordering, PatId... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs | src/tools/rust-analyzer/crates/hir-ty/src/infer.rs | //! Type inference, i.e. the process of walking through the code and determining
//! the type of each expression and pattern.
//!
//! For type inference, compare the implementations in rustc (the various
//! check_* methods in rustc_hir_analysis/check/mod.rs are a good entry point) and
//! IntelliJ-Rust (org.rust.lang.... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics.rs | src/tools/rust-analyzer/crates/hir-ty/src/diagnostics.rs | //! Type inference-based diagnostics.
mod decl_check;
mod expr;
mod match_check;
mod unsafe_check;
pub use crate::diagnostics::{
decl_check::{CaseType, IncorrectCase, incorrect_case},
expr::{
BodyValidationDiagnostic, record_literal_missing_fields, record_pattern_missing_fields,
},
unsafe_check... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs | src/tools/rust-analyzer/crates/hir-ty/src/lib.rs | //! The type system. We currently use this to infer types for completion, hover
//! information and various assists.
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
// It's useful to refer to code that is private in doc comments.
#![allow(rustdoc::private_intra_doc_links)]
// FIXME: We used to import `... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/tests.rs | src/tools/rust-analyzer/crates/hir-ty/src/tests.rs | mod closure_captures;
mod coercion;
mod diagnostics;
mod display_source_code;
mod incremental;
mod macros;
mod method_resolution;
mod never_type;
mod opaque_types;
mod patterns;
mod regression;
mod simple;
mod trait_aliases;
mod traits;
use base_db::{Crate, SourceDatabase};
use expect_test::Expect;
use hir_def::{
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/lower.rs | src/tools/rust-analyzer/crates/hir-ty/src/lower.rs | //! Methods for lowering the HIR to types. There are two main cases here:
//!
//! - Lowering a type reference like `&usize` or `Option<foo::bar::Baz>` to a
//! type: The entry point for this is `TyLoweringContext::lower_ty`.
//! - Building the type for an item: This happens through the `ty` query.
//!
//! This usu... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/upvars.rs | src/tools/rust-analyzer/crates/hir-ty/src/upvars.rs | //! A simple query to collect tall locals (upvars) a closure use.
use hir_def::{
DefWithBodyId,
expr_store::{Body, path::Path},
hir::{BindingId, Expr, ExprId, ExprOrPatId, Pat},
resolver::{HasResolver, Resolver, ValueNs},
};
use hir_expand::mod_path::PathKind;
use rustc_hash::{FxHashMap, FxHashSet};
u... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs | src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs | //! In certain situations, rust automatically inserts derefs as necessary: for
//! example, field accesses `foo.bar` still work when `foo` is actually a
//! reference to a type with the field `bar`. This is an approximation of the
//! logic in rustc (which lives in rustc_hir_analysis/check/autoderef.rs).
use std::fmt;... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/test_db.rs | src/tools/rust-analyzer/crates/hir-ty/src/test_db.rs | //! Database used for testing `hir`.
use std::{fmt, panic, sync::Mutex};
use base_db::{
CrateGraphBuilder, CratesMap, FileSourceRootInput, FileText, Nonce, RootQueryDb,
SourceDatabase, SourceRoot, SourceRootId, SourceRootInput,
};
use hir_def::{ModuleId, db::DefDatabase, nameres::crate_def_map};
use hir_expa... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/generics.rs | src/tools/rust-analyzer/crates/hir-ty/src/generics.rs | //! Utilities for working with generics.
//!
//! The layout for generics as expected by chalk are as follows:
//! - Parent parameters
//! - Optional Self parameter
//! - Lifetime parameters
//! - Type or Const parameters
//!
//! where parent follows the same scheme.
use std::ops;
use hir_def::{
ConstParamId, Gener... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/next_solver.rs | src/tools/rust-analyzer/crates/hir-ty/src/next_solver.rs | //! Things relevant to the next trait solver.
// Note: in interned types defined in this module, we generally treat the lifetime as advisory
// and transmute it as needed. This is because no real memory unsafety can be caused from an
// incorrect lifetime here.
pub mod abi;
mod binder;
mod consts;
mod def_id;
pub mod... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/display.rs | src/tools/rust-analyzer/crates/hir-ty/src/display.rs | //! The `HirDisplay` trait, which serves two purposes: Turning various bits from
//! HIR back into source code, and just displaying them for debugging/testing
//! purposes.
use std::{
fmt::{self, Debug},
mem,
};
use base_db::{Crate, FxIndexMap};
use either::Either;
use hir_def::{
FindPathConfig, GenericDe... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/utils.rs | src/tools/rust-analyzer/crates/hir-ty/src/utils.rs | //! Helper functions for working with def, which don't need to be a separate
//! query, but can't be computed directly from `*Data` (ie, which need a `db`).
use std::cell::LazyCell;
use base_db::target::{self, TargetData};
use hir_def::{
EnumId, EnumVariantId, FunctionId, Lookup, TraitId,
attrs::AttrFlags,
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/crates/hir-ty/src/lang_items.rs | src/tools/rust-analyzer/crates/hir-ty/src/lang_items.rs | //! Functions to detect special lang items
use hir_def::{AdtId, TraitId, lang_item::LangItems, signatures::StructFlags};
use intern::{Symbol, sym};
use crate::db::HirDatabase;
pub fn is_box(db: &dyn HirDatabase, adt: AdtId) -> bool {
let AdtId::StructId(id) = adt else { return false };
db.struct_signature(id... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.