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/hir-ty/src/lower/diagnostics.rs | src/tools/rust-analyzer/crates/hir-ty/src/lower/diagnostics.rs | //! This files contains the declaration of diagnostics kinds for ty and path lowering.
use hir_def::type_ref::TypeRefId;
use hir_def::{GenericDefId, GenericParamId};
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct TyLoweringDiagnostic {
pub source: TypeRefId,
pub kind: TyLoweringDiagnosticKind,
}
#[derive(... | 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/path.rs | src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs | //! A wrapper around [`TyLoweringContext`] specifically for lowering paths.
use either::Either;
use hir_def::{
GenericDefId, GenericParamId, Lookup, TraitId, TypeAliasId,
expr_store::{
ExpressionStore, HygieneId,
path::{
GenericArg as HirGenericArg, GenericArgs as HirGenericArgs, Ge... | 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/consteval/tests.rs | src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs | use base_db::RootQueryDb;
use hir_def::db::DefDatabase;
use hir_expand::EditionedFileId;
use rustc_apfloat::{
Float,
ieee::{Half as f16, Quad as f128},
};
use rustc_type_ir::inherent::IntoKind;
use test_fixture::WithFixture;
use test_utils::skip_slow_tests;
use crate::{
MemoryMap,
consteval::try_const_... | 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/consteval/tests/intrinsics.rs | src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests/intrinsics.rs | use super::*;
#[test]
fn size_of() {
check_number(
r#"
#[rustc_intrinsic]
pub fn size_of<T>() -> usize;
const GOAL: usize = size_of::<i32>();
"#,
4,
);
}
#[test]
fn size_of_val() {
check_number(
r#"
//- minicore: coerce_unsized
#[rus... | 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/lower.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs | //! This module generates a polymorphic MIR from a hir body
use std::{fmt::Write, iter, mem};
use base_db::Crate;
use hir_def::{
AdtId, DefWithBodyId, EnumVariantId, GeneralConstId, GenericParamId, HasModule,
ItemContainerId, LocalFieldId, Lookup, TraitId, TupleId,
expr_store::{Body, ExpressionStore, Hygi... | 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/mir/monomorphization.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/monomorphization.rs | //! Monomorphization of mir, which is used in mir interpreter and const eval.
//!
//! The job of monomorphization is:
//! * Monomorphization. That is, replacing `Option<T>` with `Option<i32>` where `T:=i32` substitution
//! is provided
//! * Normalizing types, for example replacing RPIT of other functions called in 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/hir-ty/src/mir/borrowck.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs | //! MIR borrow checker, which is used in diagnostics like `unused_mut`
// Currently it is an ad-hoc implementation, only useful for mutability analysis. Feel free to remove all of these
// if needed for implementing a proper borrow checker.
use std::iter;
use hir_def::{DefWithBodyId, HasModule};
use la_arena::ArenaM... | 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/eval.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs | //! This module provides a MIR interpreter, which is used in const eval.
use std::{borrow::Cow, cell::RefCell, fmt::Write, iter, mem, ops::Range};
use base_db::{Crate, target::TargetLoadError};
use either::Either;
use hir_def::{
AdtId, DefWithBodyId, EnumVariantId, FunctionId, GeneralConstId, HasModule, ItemConta... | 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/mir/pretty.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/pretty.rs | //! A pretty-printer for MIR.
use std::{
fmt::{Debug, Display, Write},
mem,
};
use either::Either;
use hir_def::{expr_store::Body, hir::BindingId};
use hir_expand::{Lookup, name::Name};
use la_arena::ArenaMap;
use crate::{
db::{HirDatabase, InternedClosureId},
display::{ClosureStyle, DisplayTarget, H... | 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/eval/tests.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/tests.rs | use hir_def::{HasModule, db::DefDatabase};
use hir_expand::EditionedFileId;
use span::Edition;
use syntax::{TextRange, TextSize};
use test_fixture::WithFixture;
use crate::{
db::HirDatabase,
display::DisplayTarget,
mir::MirLowerError,
next_solver::{DbInterner, GenericArgs},
setup_tracing,
test_... | 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/eval/shim.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs | //! Interpret intrinsics, lang items and `extern "C"` wellknown functions which their implementation
//! is not available.
//!
use std::cmp::{self, Ordering};
use hir_def::{attrs::AttrFlags, signatures::FunctionSignature};
use hir_expand::name::Name;
use intern::sym;
use rustc_type_ir::inherent::{AdtDef, IntoKind, Sli... | 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/mir/eval/shim/simd.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs | //! Shim implementation for simd intrinsics
use std::cmp::Ordering;
use crate::consteval::try_const_usize;
use super::*;
impl<'db> Evaluator<'db> {
fn detect_simd_ty(&self, ty: Ty<'db>) -> Result<'db, (usize, Ty<'db>)> {
match ty.kind() {
TyKind::Adt(adt_def, subst) => {
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/hir-ty/src/mir/lower/tests.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/tests.rs | use hir_def::DefWithBodyId;
use test_fixture::WithFixture;
use crate::{db::HirDatabase, setup_tracing, test_db::TestDB};
fn lower_mir(#[rust_analyzer::rust_fixture] ra_fixture: &str) {
let _tracing = setup_tracing();
let (db, file_ids) = TestDB::with_many_files(ra_fixture);
crate::attach_db(&db, || {
... | 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/lower/as_place.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/as_place.rs | //! MIR lowering for places
use hir_def::FunctionId;
use intern::sym;
use rustc_type_ir::inherent::{Region as _, Ty as _};
use super::*;
use crate::{
mir::{MutBorrowKind, Operand, OperandKind},
next_solver::Region,
};
macro_rules! not_supported {
($it: expr) => {
return Err(MirLowerError::NotSupp... | 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/lower/pattern_matching.rs | src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs | //! MIR lowering for patterns
use hir_def::{hir::ExprId, signatures::VariantFields};
use rustc_type_ir::inherent::{IntoKind, Ty as _};
use crate::{
BindingMode,
mir::{
LocalId, MutBorrowKind, Operand, OperandKind,
lower::{
BasicBlockId, BinOp, BindingId, BorrowKind, Either, Expr, F... | 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/dyn_compatibility/tests.rs | src/tools/rust-analyzer/crates/hir-ty/src/dyn_compatibility/tests.rs | use std::ops::ControlFlow;
use hir_def::db::DefDatabase;
use rustc_hash::{FxHashMap, FxHashSet};
use syntax::ToSmolStr;
use test_fixture::WithFixture;
use crate::{dyn_compatibility::dyn_compatibility_with_callback, test_db::TestDB};
use super::{
DynCompatibilityViolation,
MethodViolationCode::{self, *},
};
... | 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/project-model/src/workspace.rs | src/tools/rust-analyzer/crates/project-model/src/workspace.rs | //! Handles lowering of build-system specific workspace information (`cargo
//! metadata` or `rust-project.json`) into representation stored in the salsa
//! database -- `CrateGraph`.
use std::thread::Builder;
use std::{collections::VecDeque, fmt, fs, iter, ops::Deref, sync, thread};
use anyhow::Context;
use base_db:... | 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/project-model/src/lib.rs | src/tools/rust-analyzer/crates/project-model/src/lib.rs | //! In rust-analyzer, we maintain a strict separation between pure abstract
//! semantic project model and a concrete model of a particular build system.
//!
//! Pure model is represented by the `base_db::CrateGraph` from another crate.
//!
//! In this crate, we are concerned with "real world" project models.
//!
//! 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/project-model/src/tests.rs | src/tools/rust-analyzer/crates/project-model/src/tests.rs | use std::env::temp_dir;
use base_db::{CrateGraphBuilder, ProcMacroPaths};
use cargo_metadata::Metadata;
use cfg::{CfgAtom, CfgDiff};
use expect_test::{ExpectFile, expect_file};
use intern::sym;
use paths::{AbsPath, AbsPathBuf, Utf8Path, Utf8PathBuf};
use rustc_hash::FxHashMap;
use serde::de::DeserializeOwned;
use span... | 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/project-model/src/cargo_config_file.rs | src/tools/rust-analyzer/crates/project-model/src/cargo_config_file.rs | //! Read `.cargo/config.toml` as a TOML table
use paths::{AbsPath, Utf8Path, Utf8PathBuf};
use rustc_hash::FxHashMap;
use toml::{
Spanned,
de::{DeTable, DeValue},
};
use toolchain::Tool;
use crate::{ManifestPath, Sysroot, utf8_stdout};
#[derive(Clone)]
pub struct CargoConfigFile(String);
impl CargoConfigFile... | 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/project-model/src/env.rs | src/tools/rust-analyzer/crates/project-model/src/env.rs | //! Cargo-like environment variables injection.
use base_db::Env;
use paths::Utf8Path;
use rustc_hash::FxHashMap;
use crate::{PackageData, TargetKind, cargo_config_file::CargoConfigFile};
/// Recreates the compile-time environment variables that Cargo sets.
///
/// Should be synced with
/// <https://doc.rust-lang.org... | 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/project-model/src/cargo_workspace.rs | src/tools/rust-analyzer/crates/project-model/src/cargo_workspace.rs | //! See [`CargoWorkspace`].
use std::{borrow::Cow, ops, str::from_utf8};
use anyhow::Context;
use base_db::Env;
use cargo_metadata::{CargoOpt, MetadataCommand, PackageId};
use la_arena::{Arena, Idx};
use paths::{AbsPath, AbsPathBuf, Utf8Path, Utf8PathBuf};
use rustc_hash::{FxHashMap, FxHashSet};
use serde_derive::Des... | 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/project-model/src/build_dependencies.rs | src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs | //! Logic to invoke `cargo` for building build-dependencies (build scripts and proc-macros) as well as
//! executing the build scripts to fetch required dependency information (`OUT_DIR` env var, extra
//! cfg flags, etc).
//!
//! In essence this just invokes `cargo` with the appropriate output format which we consume,... | 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/project-model/src/sysroot.rs | src/tools/rust-analyzer/crates/project-model/src/sysroot.rs | //! Loads "sysroot" crate.
//!
//! One confusing point here is that normally sysroot is a bunch of `.rlib`s,
//! but we can't process `.rlib` and need source code instead. The source code
//! is typically installed with `rustup component add rust-src` command.
use core::fmt;
use std::{env, fs, ops::Not, path::Path, pr... | 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/project-model/src/project_json.rs | src/tools/rust-analyzer/crates/project-model/src/project_json.rs | //! `rust-project.json` file format.
//!
//! This format is spiritually a serialization of `base_db::CrateGraph`. The
//! idea here is that people who do not use Cargo, can instead teach their build
//! system to generate `rust-project.json` which can be ingested by
//! rust-analyzer.
//!
//! This short file is a somew... | 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/project-model/src/manifest_path.rs | src/tools/rust-analyzer/crates/project-model/src/manifest_path.rs | //! See [`ManifestPath`].
use std::{borrow::Borrow, fmt, ops};
use paths::{AbsPath, AbsPathBuf, Utf8Path};
/// More or less [`AbsPathBuf`] with non-None parent.
///
/// We use it to store path to Cargo.toml, as we frequently use the parent dir
/// as a working directory to spawn various commands, and its nice to not ... | 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/project-model/src/toolchain_info/target_tuple.rs | src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_tuple.rs | //! Functionality to discover the current build target(s).
use std::path::Path;
use anyhow::Context;
use rustc_hash::FxHashMap;
use toolchain::Tool;
use crate::{
Sysroot, cargo_config_file::CargoConfigFile, toolchain_info::QueryConfig, utf8_stdout,
};
/// For cargo, runs `cargo -Zunstable-options config get buil... | 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/project-model/src/toolchain_info/version.rs | src/tools/rust-analyzer/crates/project-model/src/toolchain_info/version.rs | //! Get the version string of the toolchain.
use anyhow::Context;
use rustc_hash::FxHashMap;
use semver::Version;
use toolchain::Tool;
use crate::{toolchain_info::QueryConfig, utf8_stdout};
pub(crate) fn get(
config: QueryConfig<'_>,
extra_env: &FxHashMap<String, Option<String>>,
) -> Result<Option<Version>,... | 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/project-model/src/toolchain_info/target_data.rs | src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_data.rs | //! Runs `rustc --print target-spec-json` to get the target_data_layout.
use anyhow::Context;
use base_db::target;
use rustc_hash::FxHashMap;
use serde_derive::Deserialize;
use toolchain::Tool;
use crate::{Sysroot, toolchain_info::QueryConfig, utf8_stdout};
#[derive(Debug, Deserialize)]
#[serde(rename_all = "kebab-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/project-model/src/toolchain_info/rustc_cfg.rs | src/tools/rust-analyzer/crates/project-model/src/toolchain_info/rustc_cfg.rs | //! Get the built-in cfg flags for the to be compile platform.
use anyhow::Context;
use cfg::CfgAtom;
use rustc_hash::FxHashMap;
use toolchain::Tool;
use crate::{toolchain_info::QueryConfig, utf8_stdout};
/// Uses `rustc --print cfg` to fetch the builtin cfgs.
pub fn get(
config: QueryConfig<'_>,
target: Opt... | 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/edition/src/lib.rs | src/tools/rust-analyzer/crates/edition/src/lib.rs | //! The edition of the Rust language used in a crate.
// This should live in a separate crate because we use it in both actual code and codegen.
use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum Edition {
// The syntax context stuff needs the discriminants to st... | 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-db/src/ra_fixture.rs | src/tools/rust-analyzer/crates/ide-db/src/ra_fixture.rs | //! Working with the fixtures in r-a tests, and providing IDE services for them.
use std::hash::{BuildHasher, Hash};
use hir::{CfgExpr, FilePositionWrapper, FileRangeWrapper, Semantics, Symbol};
use smallvec::SmallVec;
use span::{TextRange, TextSize};
use syntax::{
AstToken, SmolStr,
ast::{self, IsString},
};... | 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-db/src/documentation.rs | src/tools/rust-analyzer/crates/ide-db/src/documentation.rs | //! Documentation attribute related utilities.
use std::borrow::Cow;
use hir::{HasAttrs, db::HirDatabase, resolve_doc_path_on};
/// Holds documentation
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Documentation<'db>(Cow<'db, str>);
impl<'db> Documentation<'db> {
#[inline]
pub fn new_owned(s: Strin... | 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-db/src/range_mapper.rs | src/tools/rust-analyzer/crates/ide-db/src/range_mapper.rs | //! Maps between ranges in documents.
use std::cmp::Ordering;
use stdx::equal_range_by;
use syntax::{TextRange, TextSize};
#[derive(Default)]
pub struct RangeMapper {
buf: String,
ranges: Vec<(TextRange, Option<TextRange>)>,
}
impl RangeMapper {
pub fn add(&mut self, text: &str, source_range: TextRange)... | 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-db/src/lib.rs | src/tools/rust-analyzer/crates/ide-db/src/lib.rs | //! This crate defines the core data structure representing IDE state -- `RootDatabase`.
//!
//! It is mainly a `HirDatabase` for semantic analysis, plus a `SymbolsDatabase`, for fuzzy search.
#![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-db/src/rust_doc.rs | src/tools/rust-analyzer/crates/ide-db/src/rust_doc.rs | //! Rustdoc specific doc comment handling
use crate::documentation::Documentation;
// stripped down version of https://github.com/rust-lang/rust/blob/392ba2ba1a7d6c542d2459fb8133bebf62a4a423/src/librustdoc/html/markdown.rs#L810-L933
pub fn is_rust_fence(s: &str) -> bool {
let mut seen_rust_tags = false;
let m... | 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-db/src/source_change.rs | src/tools/rust-analyzer/crates/ide-db/src/source_change.rs | //! This modules defines type to represent changes to the source code, that flow
//! from the server to the client.
//!
//! It can be viewed as a dual for `Change`.
use std::{collections::hash_map::Entry, fmt, iter, mem};
use crate::imports::insert_use::{ImportScope, ImportScopeKind};
use crate::text_edit::{TextEdit,... | 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-db/src/rename.rs | src/tools/rust-analyzer/crates/ide-db/src/rename.rs | //! Rename infrastructure for rust-analyzer. It is used primarily for the
//! literal "rename" in the ide (look for tests there), but it is also available
//! as a general-purpose service. For example, it is used by the fix for the
//! "incorrect case" diagnostic.
//!
//! It leverages the [`crate::search`] functionalit... | 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-db/src/helpers.rs | src/tools/rust-analyzer/crates/ide-db/src/helpers.rs | //! Random assortment of ide helpers for high-level ide features that don't fit in any other module.
use std::collections::VecDeque;
use base_db::SourceDatabase;
use hir::{Crate, ItemInNs, ModuleDef, Name, Semantics};
use span::{Edition, FileId};
use syntax::{
AstToken, SyntaxKind, SyntaxToken, ToSmolStr, TokenAt... | 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-db/src/search.rs | src/tools/rust-analyzer/crates/ide-db/src/search.rs | //! Implementation of find-usages functionality.
//!
//! It is based on the standard ide trick: first, we run a fast text search to
//! get a super-set of matches. Then, we confirm each match using precise
//! name resolution.
use std::mem;
use std::{cell::LazyCell, cmp::Reverse};
use base_db::{RootQueryDb, SourceDat... | 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-db/src/items_locator.rs | src/tools/rust-analyzer/crates/ide-db/src/items_locator.rs | //! This module has the functionality to search the project and its dependencies for a certain item,
//! by its name and a few criteria.
//! The main reason for this module to exist is the fact that project's items and dependencies' items
//! are located in different caches, with different APIs.
use std::ops::ControlFl... | 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-db/src/defs.rs | src/tools/rust-analyzer/crates/ide-db/src/defs.rs | //! `NameDefinition` keeps information about the element we want to search references for.
//! The element is represented by `NameKind`. It's located inside some `container` and
//! has a `visibility`, which defines a search scope.
//! Note that the reference search is possible for not all of the classified items.
// ... | 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-db/src/assists.rs | src/tools/rust-analyzer/crates/ide-db/src/assists.rs | //! This module defines the `Assist` data structure. The actual assist live in
//! the `ide_assists` downstream crate. We want to define the data structures in
//! this low-level crate though, because `ide_diagnostics` also need them
//! (fixits for diagnostics and assists are the same thing under the hood). We
//! wan... | 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-db/src/symbol_index.rs | src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs | //! This module handles fuzzy-searching of functions, structs and other symbols
//! by name across the whole workspace and dependencies.
//!
//! It works by building an incrementally-updated text-search index of all
//! symbols. The backbone of the index is the **awesome** `fst` crate by
//! @BurntSushi.
//!
//! In a n... | 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-db/src/ty_filter.rs | src/tools/rust-analyzer/crates/ide-db/src/ty_filter.rs | //! This module contains structures for filtering the expected types.
//! Use case for structures in this module is, for example, situation when you need to process
//! only certain `Enum`s.
use std::iter;
use hir::Semantics;
use syntax::ast::{self, Pat, make};
use crate::RootDatabase;
/// Enum types that implement... | 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-db/src/active_parameter.rs | src/tools/rust-analyzer/crates/ide-db/src/active_parameter.rs | //! This module provides functionality for querying callable information about a token.
use either::Either;
use hir::{InFile, Semantics, Type};
use parser::T;
use span::TextSize;
use syntax::{
AstNode, NodeOrToken, SyntaxKind, SyntaxNode, SyntaxToken,
ast::{self, AstChildren, HasArgList, HasAttrs, HasName},
... | 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-db/src/apply_change.rs | src/tools/rust-analyzer/crates/ide-db/src/apply_change.rs | //! Applies changes to the IDE state transactionally.
use profile::Bytes;
use salsa::Database as _;
use crate::{ChangeWithProcMacros, RootDatabase};
impl RootDatabase {
pub fn apply_change(&mut self, change: ChangeWithProcMacros) {
let _p = tracing::info_span!("RootDatabase::apply_change").entered();
... | 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-db/src/text_edit.rs | src/tools/rust-analyzer/crates/ide-db/src/text_edit.rs | //! Representation of a `TextEdit`.
//!
//! `rust-analyzer` never mutates text itself and only sends diffs to clients,
//! so `TextEdit` is the ultimate representation of the work done by
//! rust-analyzer.
use itertools::Itertools;
use macros::UpmapFromRaFixture;
pub use span::{TextRange, TextSize};
use std::cmp::max... | 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-db/src/famous_defs.rs | src/tools/rust-analyzer/crates/ide-db/src/famous_defs.rs | //! See [`FamousDefs`].
use base_db::{CrateOrigin, LangCrateOrigin};
use hir::{Crate, Enum, Function, Macro, Module, ScopeDef, Semantics, Trait};
use crate::RootDatabase;
/// Helps with finding well-know things inside the standard library. This is
/// somewhat similar to the known paths infra inside hir, but it diff... | 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-db/src/label.rs | src/tools/rust-analyzer/crates/ide-db/src/label.rs | //! See [`Label`]
use std::fmt;
use stdx::always;
/// A type to specify UI label, like an entry in the list of assists. Enforces
/// proper casing:
///
/// Frobnicate bar
///
/// Note the upper-case first letter and the absence of `.` at the end.
#[derive(Clone)]
pub struct Label(String);
impl PartialEq<str> 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-db/src/traits.rs | src/tools/rust-analyzer/crates/ide-db/src/traits.rs | //! Functionality for obtaining data related to traits from the DB.
use crate::{RootDatabase, defs::Definition};
use hir::{AsAssocItem, Semantics, db::HirDatabase};
use rustc_hash::FxHashSet;
use syntax::{AstNode, ast};
/// Given the `impl` block, attempts to find the trait this `impl` corresponds to.
pub fn resolve_... | 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-db/src/path_transform.rs | src/tools/rust-analyzer/crates/ide-db/src/path_transform.rs | //! See [`PathTransform`].
use crate::helpers::mod_path_to_ast;
use either::Either;
use hir::{
AsAssocItem, FindPathConfig, HirDisplay, HirFileId, ModuleDef, SemanticsScope,
prettify_macro_expansion,
};
use itertools::Itertools;
use rustc_hash::FxHashMap;
use span::Edition;
use syntax::{
NodeOrToken, Synta... | 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-db/src/prime_caches.rs | src/tools/rust-analyzer/crates/ide-db/src/prime_caches.rs | //! rust-analyzer is lazy and doesn't compute anything unless asked. This
//! sometimes is counter productive when, for example, the first goto definition
//! request takes longer to compute. This module implements prepopulation of
//! various caches, it's not really advanced at the moment.
use std::panic::AssertUnwind... | 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-db/src/use_trivial_constructor.rs | src/tools/rust-analyzer/crates/ide-db/src/use_trivial_constructor.rs | //! Functionality for generating trivial constructors
use hir::StructKind;
use span::Edition;
use syntax::{
ToSmolStr,
ast::{Expr, Path, make},
};
/// given a type return the trivial constructor (if one exists)
pub fn use_trivial_constructor(
db: &crate::RootDatabase,
path: Path,
ty: &hir::Type<'_... | 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-db/src/syntax_helpers/suggest_name.rs | src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/suggest_name.rs | //! This module contains functions to suggest names for expressions, functions and other items
use std::{collections::hash_map::Entry, str::FromStr};
use hir::{Semantics, SemanticsScope};
use itertools::Itertools;
use rustc_hash::FxHashMap;
use stdx::to_lower_snake_case;
use syntax::{
AstNode, Edition, SmolStr, 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/ide-db/src/syntax_helpers/format_string.rs | src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string.rs | //! Tools to work with format string literals for the `format_args!` family of macros.
use syntax::{
AstNode, AstToken, TextRange, TextSize,
ast::{self, IsString},
};
// FIXME: This can probably be re-implemented via the HIR?
pub fn is_format_string(string: &ast::String) -> bool {
// Check if `string` is 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-db/src/syntax_helpers/node_ext.rs | src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs | //! Various helper functions to work with SyntaxNodes.
use std::ops::ControlFlow;
use either::Either;
use itertools::Itertools;
use parser::T;
use span::Edition;
use syntax::{
AstNode, AstToken, Direction, Preorder, RustLanguage, SyntaxToken, WalkEvent,
algo::non_trivia_sibling,
ast::{self, HasLoopBody, 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-db/src/syntax_helpers/format_string_exprs.rs | src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string_exprs.rs | //! Tools to work with expressions present in format string literals for the `format_args!` family of macros.
//! Primarily meant for assists and completions.
/// Enum for representing extracted format string args.
/// Can either be extracted expressions (which includes identifiers),
/// or placeholders `{}`.
#[derive... | 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-db/src/syntax_helpers/tree_diff.rs | src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/tree_diff.rs | //! Basic tree diffing functionality.
use rustc_hash::FxHashMap;
use syntax::{NodeOrToken, SyntaxElement, SyntaxNode};
use crate::{FxIndexMap, text_edit::TextEditBuilder};
#[derive(Debug, Hash, PartialEq, Eq)]
enum TreeDiffInsertPos {
After(SyntaxElement),
AsFirstChild(SyntaxElement),
}
#[derive(Debug)]
pub ... | 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-db/src/generated/lints.rs | src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs | //! Generated by `cargo codegen lint-definitions`, do not edit by hand.
use span::Edition;
use crate::Severity;
#[derive(Clone)]
pub struct Lint {
pub label: &'static str,
pub description: &'static str,
pub default_severity: Severity,
pub warn_since: Option<Edition>,
pub deny_since: Option<Editio... | 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-db/src/imports/import_assets.rs | src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs | //! Look up accessible paths for items.
use std::{convert::Infallible, ops::ControlFlow};
use hir::{
AsAssocItem, AssocItem, AssocItemContainer, Complete, Crate, FindPathConfig, HasCrate,
ItemInNs, ModPath, Module, ModuleDef, Name, PathResolution, PrefixKind, ScopeDef, Semantics,
SemanticsScope, Trait, Ty... | 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-db/src/imports/insert_use.rs | src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs | //! Handle syntactic aspects of inserting a new `use` item.
#[cfg(test)]
mod tests;
use std::cmp::Ordering;
use hir::Semantics;
use syntax::{
Direction, NodeOrToken, SyntaxKind, SyntaxNode, algo,
ast::{
self, AstNode, HasAttrs, HasModuleItem, HasVisibility, PathSegmentKind,
edit_in_place::Remo... | 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-db/src/imports/merge_imports.rs | src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs | //! Handle syntactic aspects of merging UseTrees.
use std::cmp::Ordering;
use itertools::{EitherOrBoth, Itertools};
use parser::T;
use syntax::{
Direction, SyntaxElement, algo,
ast::{
self, AstNode, HasAttrs, HasName, HasVisibility, PathSegmentKind, edit_in_place::Removable,
make,
},
te... | 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-db/src/imports/insert_use/tests.rs | src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use/tests.rs | use stdx::trim_indent;
use test_fixture::WithFixture;
use test_utils::{CURSOR_MARKER, assert_eq_text};
use super::*;
#[test]
fn trailing_comment_in_empty_file() {
check(
"foo::bar",
r#"
struct Struct;
// 0 = 1
"#,
r#"
use foo::bar;
struct Struct;
// 0 = 1
"#,
ImportGranularity::Cr... | 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/query-group-macro/src/queries.rs | src/tools/rust-analyzer/crates/query-group-macro/src/queries.rs | //! The IR of the `#[query_group]` macro.
use quote::{ToTokens, format_ident, quote, quote_spanned};
use syn::{FnArg, Ident, PatType, Path, Receiver, ReturnType, Type, parse_quote, spanned::Spanned};
use crate::Cycle;
pub(crate) struct TrackedQuery {
pub(crate) trait_name: Ident,
pub(crate) signature: syn::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/query-group-macro/src/lib.rs | src/tools/rust-analyzer/crates/query-group-macro/src/lib.rs | //! A macro that mimics the old Salsa-style `#[query_group]` macro.
use core::fmt;
use std::vec;
use proc_macro::TokenStream;
use proc_macro2::Span;
use queries::{
GeneratedInputStruct, InputQuery, InputSetter, InputSetterWithDurability, Intern, Lookup,
Queries, SetterKind, TrackedQuery, Transparent,
};
use q... | 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/query-group-macro/tests/multiple_dbs.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/multiple_dbs.rs | use query_group_macro::query_group;
#[query_group]
pub trait DatabaseOne: salsa::Database {
#[salsa::input]
fn input_string(&self) -> String;
// unadorned query
#[salsa::invoke_interned(length)]
fn length(&self, key: ()) -> usize;
}
#[query_group]
pub trait DatabaseTwo: DatabaseOne {
#[salsa:... | 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/query-group-macro/tests/supertrait.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/supertrait.rs | use query_group_macro::query_group;
#[salsa_macros::db]
pub trait SourceDb: salsa::Database {
/// Text of the file.
fn file_text(&self, id: usize) -> String;
}
#[query_group]
pub trait RootDb: SourceDb {
#[salsa::invoke_interned(parse)]
fn parse(&self, id: usize) -> String;
}
fn parse(db: &dyn RootDb... | 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/query-group-macro/tests/hello_world.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/hello_world.rs | use expect_test::expect;
use query_group_macro::query_group;
mod logger_db;
use logger_db::LoggerDb;
#[query_group]
pub trait HelloWorldDatabase: salsa::Database {
// input
// // input with no params
#[salsa::input]
fn input_string(&self) -> String;
// unadorned query
#[salsa::invoke_interned... | 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/query-group-macro/tests/lru.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/lru.rs | use expect_test::expect;
mod logger_db;
use logger_db::LoggerDb;
use query_group_macro::query_group;
#[query_group]
pub trait LruDB: salsa::Database {
// // input with no params
#[salsa::input]
fn input_string(&self) -> String;
#[salsa::lru(16)]
#[salsa::invoke_interned(length_query)]
fn leng... | 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/query-group-macro/tests/logger_db.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/logger_db.rs | use std::sync::{Arc, Mutex};
#[salsa_macros::db]
#[derive(Clone)]
pub(crate) struct LoggerDb {
storage: salsa::Storage<Self>,
logger: Logger,
}
impl Default for LoggerDb {
fn default() -> Self {
let logger = Logger::default();
Self {
storage: salsa::Storage::new(Some(Box::new({... | 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/query-group-macro/tests/old_and_new.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/old_and_new.rs | use expect_test::expect;
mod logger_db;
use logger_db::LoggerDb;
use query_group_macro::query_group;
#[salsa_macros::input]
struct Input {
str: String,
}
#[query_group]
trait PartialMigrationDatabase: salsa::Database {
fn length_query(&self, input: Input) -> usize;
// renamed/invoke query
#[salsa::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/query-group-macro/tests/result.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/result.rs | mod logger_db;
use expect_test::expect;
use logger_db::LoggerDb;
use query_group_macro::query_group;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Error;
#[query_group]
pub trait ResultDatabase: salsa::Database {
#[salsa::input]
fn input_string(&self) -> String;
#[salsa::invoke_interned(length)]
... | 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/query-group-macro/tests/arity.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/arity.rs | use query_group_macro::query_group;
#[query_group]
pub trait ArityDb: salsa::Database {
#[salsa::invoke_interned(one)]
fn one(&self, a: ()) -> String;
#[salsa::invoke_interned(two)]
fn two(&self, a: (), b: ()) -> String;
#[salsa::invoke_interned(three)]
fn three(&self, a: (), b: (), 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/query-group-macro/tests/tuples.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/tuples.rs | use query_group_macro::query_group;
mod logger_db;
use expect_test::expect;
use logger_db::LoggerDb;
#[query_group]
pub trait HelloWorldDatabase: salsa::Database {
#[salsa::input]
fn input_string(&self) -> String;
#[salsa::invoke_interned(length_query)]
fn length_query(&self, key: ()) -> (usize, usiz... | 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/query-group-macro/tests/interned.rs | src/tools/rust-analyzer/crates/query-group-macro/tests/interned.rs | use query_group_macro::query_group;
use expect_test::expect;
use salsa::plumbing::AsId;
mod logger_db;
use logger_db::LoggerDb;
#[salsa_macros::interned(no_lifetime)]
pub struct InternedString {
data: String,
}
#[query_group]
pub trait InternedDB: salsa::Database {
#[salsa::interned]
fn intern_string(&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/hir-expand/src/db.rs | src/tools/rust-analyzer/crates/hir-expand/src/db.rs | //! Defines database & queries for macro expansion.
use base_db::{Crate, RootQueryDb};
use mbe::MatchedArmIndex;
use span::{AstIdMap, Edition, Span, SyntaxContext};
use syntax::{AstNode, Parse, SyntaxError, SyntaxNode, SyntaxToken, T, ast};
use syntax_bridge::{DocCommentDesugarMode, syntax_node_to_token_tree};
use tri... | 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-expand/src/eager.rs | src/tools/rust-analyzer/crates/hir-expand/src/eager.rs | //! Eager expansion related utils
//!
//! Here is a dump of a discussion from Vadim Petrochenkov about Eager Expansion and
//! Its name resolution :
//!
//! > Eagerly expanded macros (and also macros eagerly expanded by eagerly expanded macros,
//! > which actually happens in practice too!) are resolved at the location... | 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-expand/src/inert_attr_macro.rs | src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs | //! Builtin attributes resolved by nameres.
//!
//! The actual definitions were copied from rustc's `compiler/rustc_feature/src/builtin_attrs.rs`.
//!
//! It was last synchronized with upstream commit c3def263a44e07e09ae6d57abfc8650227fb4972.
//!
//! The macros were adjusted to only expand to the attribute name, since ... | 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-expand/src/attrs.rs | src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs | //! Defines the basics of attributes lowering.
//!
//! The heart and soul of this module is [`expand_cfg_attr()`], alongside its sibling
//! [`expand_cfg_attr_with_doc_comments()`]. It is used to implement all attribute lowering
//! in r-a. Its basic job is to list attributes; however, attributes do not necessarily map... | 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-expand/src/cfg_process.rs | src/tools/rust-analyzer/crates/hir-expand/src/cfg_process.rs | //! Processes out #[cfg] and #[cfg_attr] attributes from the input for the derive macro
use std::{cell::OnceCell, ops::ControlFlow};
use ::tt::TextRange;
use base_db::Crate;
use cfg::CfgExpr;
use parser::T;
use smallvec::SmallVec;
use syntax::{
AstNode, PreorderWithTokens, SyntaxElement, SyntaxNode, SyntaxToken, W... | 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-expand/src/lib.rs | src/tools/rust-analyzer/crates/hir-expand/src/lib.rs | //! `hir_expand` deals with macro expansion.
//!
//! Specifically, it implements a concept of `MacroFile` -- a file whose syntax
//! tree originates not from the text of some `FileId`, but from some macro
//! expansion.
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
// It's useful to refer to code that ... | 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-expand/src/prettify_macro_expansion_.rs | src/tools/rust-analyzer/crates/hir-expand/src/prettify_macro_expansion_.rs | //! Pretty printing of macros output.
use base_db::Crate;
use rustc_hash::FxHashMap;
use syntax::NodeOrToken;
use syntax::{SyntaxNode, ast::make};
use crate::{db::ExpandDatabase, span_map::ExpansionSpanMap};
/// Inserts whitespace and replaces `$crate` in macro expansions.
#[expect(deprecated)]
pub fn prettify_macro... | 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-expand/src/mod_path.rs | src/tools/rust-analyzer/crates/hir-expand/src/mod_path.rs | //! A lowering for `use`-paths (more generally, paths without angle-bracketed segments).
use std::{
fmt::{self, Display as _},
iter::{self, Peekable},
};
use crate::{
db::ExpandDatabase,
hygiene::Transparency,
name::{AsName, Name},
tt,
};
use base_db::Crate;
use intern::{Symbol, sym};
use pars... | 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-expand/src/change.rs | src/tools/rust-analyzer/crates/hir-expand/src/change.rs | //! Defines a unit of change that can applied to the database to get the next
//! state. Changes are transactional.
use base_db::{CrateGraphBuilder, FileChange, SourceRoot, salsa::Durability};
use span::FileId;
use triomphe::Arc;
use crate::{db::ExpandDatabase, proc_macro::ProcMacrosBuilder};
#[derive(Debug, Default)... | 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-expand/src/hygiene.rs | src/tools/rust-analyzer/crates/hir-expand/src/hygiene.rs | //! Machinery for hygienic macros.
//!
//! Inspired by Matthew Flatt et al., “Macros That Work Together: Compile-Time Bindings, Partial
//! Expansion, and Definition Contexts,” *Journal of Functional Programming* 22, no. 2
//! (March 1, 2012): 181–216, <https://doi.org/10.1017/S0956796812000093>.
//!
//! Also see <http... | 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-expand/src/fixup.rs | src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs | //! To make attribute macros work reliably when typing, we need to take care to
//! fix up syntax errors in the code we're passing to them.
use intern::sym;
use rustc_hash::{FxHashMap, FxHashSet};
use span::{
ErasedFileAstId, FIXUP_ERASED_FILE_AST_ID_MARKER, ROOT_ERASED_FILE_AST_ID, Span, SpanAnchor,
SyntaxCon... | 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-expand/src/name.rs | src/tools/rust-analyzer/crates/hir-expand/src/name.rs | //! See [`Name`].
use std::fmt;
use intern::{Symbol, sym};
use span::{Edition, SyntaxContext};
use syntax::utils::is_raw_identifier;
use syntax::{ast, format_smolstr};
/// `Name` is a wrapper around string, which is used in hir for both references
/// and declarations. In theory, names should also carry hygiene info... | 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-expand/src/files.rs | src/tools/rust-analyzer/crates/hir-expand/src/files.rs | //! Things to wrap other things in file ids.
use std::borrow::Borrow;
use either::Either;
use span::{AstIdNode, ErasedFileAstId, FileAstId, FileId, SyntaxContext};
use syntax::{AstNode, AstPtr, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextRange, TextSize};
use crate::{
EditionedFileId, HirFileId, MacroCallId, Macr... | 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-expand/src/declarative.rs | src/tools/rust-analyzer/crates/hir-expand/src/declarative.rs | //! Compiled declarative macro expanders (`macro_rules!` and `macro`)
use std::{cell::OnceCell, ops::ControlFlow};
use base_db::Crate;
use span::{Edition, Span, SyntaxContext};
use stdx::TupleExt;
use syntax::{
AstNode, AstToken,
ast::{self, HasAttrs},
};
use syntax_bridge::DocCommentDesugarMode;
use triomphe... | 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-expand/src/span_map.rs | src/tools/rust-analyzer/crates/hir-expand/src/span_map.rs | //! Span maps for real files and macro expansions.
use span::Span;
use syntax::{AstNode, TextRange, ast};
use triomphe::Arc;
pub use span::RealSpanMap;
use crate::{HirFileId, MacroCallId, db::ExpandDatabase};
pub type ExpansionSpanMap = span::SpanMap;
/// Spanmap for a macro file or a real file
#[derive(Clone, Deb... | 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-expand/src/builtin.rs | src/tools/rust-analyzer/crates/hir-expand/src/builtin.rs | //! Builtin macros and attributes
#[macro_use]
pub mod quote;
mod attr_macro;
mod derive_macro;
mod fn_macro;
pub use self::{
attr_macro::{BuiltinAttrExpander, find_builtin_attr, pseudo_derive_attr_expansion},
derive_macro::{BuiltinDeriveExpander, find_builtin_derive},
fn_macro::{
BuiltinFnLikeExp... | 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-expand/src/proc_macro.rs | src/tools/rust-analyzer/crates/hir-expand/src/proc_macro.rs | //! Proc Macro Expander stuff
use core::fmt;
use std::any::Any;
use std::{panic::RefUnwindSafe, sync};
use base_db::{Crate, CrateBuilderId, CratesIdMap, Env, ProcMacroLoadingError, SourceDatabase};
use intern::Symbol;
use rustc_hash::FxHashMap;
use span::Span;
use triomphe::Arc;
use crate::{ExpandError, ExpandErrorK... | 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-expand/src/builtin/attr_macro.rs | src/tools/rust-analyzer/crates/hir-expand/src/builtin/attr_macro.rs | //! Builtin attributes.
use intern::sym;
use span::Span;
use crate::{ExpandResult, MacroCallId, MacroCallKind, db::ExpandDatabase, name, tt};
use super::quote;
macro_rules! register_builtin {
($(($name:ident, $variant:ident) => $expand:ident),* $(,)? ) => {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Has... | 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-expand/src/builtin/derive_macro.rs | src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs | //! Builtin derives.
use either::Either;
use intern::sym;
use itertools::{Itertools, izip};
use parser::SyntaxKind;
use rustc_hash::FxHashSet;
use span::{Edition, Span};
use stdx::never;
use syntax_bridge::DocCommentDesugarMode;
use tracing::debug;
use crate::{
ExpandError, ExpandResult, MacroCallId,
builtin:... | 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-expand/src/builtin/fn_macro.rs | src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs | //! Builtin macro
use std::borrow::Cow;
use base_db::AnchoredPath;
use cfg::CfgExpr;
use either::Either;
use intern::{
Symbol,
sym::{self},
};
use itertools::Itertools;
use mbe::{DelimiterKind, expect_fragment};
use span::{Edition, FileId, Span};
use stdx::format_to;
use syntax::{
format_smolstr,
unes... | 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-expand/src/builtin/quote.rs | src/tools/rust-analyzer/crates/hir-expand/src/builtin/quote.rs | //! A simplified version of quote-crate like quasi quote macro
#![allow(clippy::crate_in_macro_def)]
use intern::{Symbol, sym};
use span::Span;
use syntax::ToSmolStr;
use tt::IdentIsRaw;
use crate::{name::Name, tt::TopSubtreeBuilder};
pub(crate) fn dollar_crate(span: Span) -> tt::Ident {
tt::Ident { sym: sym::do... | 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/span/src/lib.rs | src/tools/rust-analyzer/crates/span/src/lib.rs | //! File and span related types.
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;
use std::fmt::{self, Write};
mod ast_id;
mod hygiene;
mod map;
pub use self::{
ast_id::{
AstIdMap, AstIdNode, ErasedFileAstId, FIXUP_ERASED_FI... | 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/span/src/map.rs | src/tools/rust-analyzer/crates/span/src/map.rs | //! A map that maps a span to every position in a file. Usually maps a span to some range of positions.
//! Allows bidirectional lookup.
use std::{fmt, hash::Hash};
use stdx::{always, itertools::Itertools};
use crate::{
EditionedFileId, ErasedFileAstId, ROOT_ERASED_FILE_AST_ID, Span, SpanAnchor, SyntaxContext,
... | 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/span/src/hygiene.rs | src/tools/rust-analyzer/crates/span/src/hygiene.rs | //! Machinery for hygienic macros.
//!
//! Inspired by Matthew Flatt et al., “Macros That Work Together: Compile-Time Bindings, Partial
//! Expansion, and Definition Contexts,” *Journal of Functional Programming* 22, no. 2
//! (March 1, 2012): 181–216, <https://doi.org/10.1017/S0956796812000093>.
//!
//! Also see <http... | 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.