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/rust-analyzer/src/tracing/hprof.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/tracing/hprof.rs | //! Consumer of `tracing` data, which prints a hierarchical profile.
//!
//! Based on <https://github.com/davidbarsky/tracing-tree>, but does less, while
//! actually printing timings for spans by default. The code here is vendored from
//! <https://github.com/matklad/tracing-span-tree>.
//!
//! Usage:
//!
//! ```ignor... | 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/rust-analyzer/src/bin/rustc_wrapper.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/bin/rustc_wrapper.rs | //! We setup RUSTC_WRAPPER to point to `rust-analyzer` binary itself during the
//! initial `cargo check`. That way, we avoid checking the actual project, and
//! only build proc macros and build.rs.
//!
//! Code taken from IntelliJ :0)
//! https://github.com/intellij-rust/intellij-rust/blob/master/native-helper/sr... | 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/rust-analyzer/src/bin/main.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/bin/main.rs | //! Driver for rust-analyzer.
//!
//! Based on cli flags, either spawns an LSP server, or runs a batch analysis
#![allow(clippy::print_stdout, clippy::print_stderr)]
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;
mod rustc_wrapper;
use... | 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/rust-analyzer/src/handlers/notification.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs | //! This module is responsible for implementing handlers for Language Server
//! Protocol. This module specifically handles notifications.
use std::{
ops::{Deref, Not as _},
panic::UnwindSafe,
};
use itertools::Itertools;
use lsp_types::{
CancelParams, DidChangeConfigurationParams, DidChangeTextDocumentPa... | 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/rust-analyzer/src/handlers/dispatch.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/dispatch.rs | //! See [RequestDispatcher].
use std::{
fmt::{self, Debug},
panic, thread,
};
use ide_db::base_db::{
DbPanicContext,
salsa::{self, Cancelled},
};
use lsp_server::{ExtractError, Response, ResponseError};
use serde::{Serialize, de::DeserializeOwned};
use stdx::thread::ThreadIntent;
use crate::{
glob... | 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/rust-analyzer/src/handlers/request.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs | //! This module is responsible for implementing handlers for Language Server
//! Protocol. This module specifically handles requests.
use std::{fs, io::Write as _, ops::Not, process::Stdio};
use anyhow::Context;
use base64::{Engine, prelude::BASE64_STANDARD};
use ide::{
AssistKind, AssistResolveStrategy, Cancell... | 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/rust-analyzer/src/diagnostics/flycheck_to_proto.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/diagnostics/flycheck_to_proto.rs | //! This module provides the functionality needed to convert diagnostics from
//! `cargo check` json format to the LSP diagnostic format.
use crate::flycheck::{Applicability, DiagnosticLevel, DiagnosticSpan};
use itertools::Itertools;
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
use stdx::format_to;
use vfs::{Ab... | 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/rust-analyzer/src/config/patch_old_style.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/config/patch_old_style.rs | //! See [`patch_json_for_outdated_configs`]
use serde_json::{Value, json};
/// This function patches the json config to the new expected keys.
/// That is we try to load old known config keys here and convert them to the new ones.
/// See https://github.com/rust-lang/rust-analyzer/pull/12010
///
/// We already have an... | 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/rust-analyzer/src/cli/diagnostics.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/diagnostics.rs | //! Analyze all modules in a project for diagnostics. Exits with a non-zero
//! status code if any errors are found.
use project_model::{CargoConfig, RustLibSource};
use rustc_hash::FxHashSet;
use hir::{Crate, Module, db::HirDatabase, sym};
use ide::{AnalysisHost, AssistResolveStrategy, Diagnostic, DiagnosticsConfig,... | 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/rust-analyzer/src/cli/highlight.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/highlight.rs | //! Read Rust code on stdin, print HTML highlighted version to stdout.
use ide::Analysis;
use crate::cli::{flags, read_stdin};
impl flags::Highlight {
pub fn run(self) -> anyhow::Result<()> {
let (analysis, file_id) = Analysis::from_single_file(read_stdin()?);
let html = analysis.highlight_as_htm... | 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/rust-analyzer/src/cli/parse.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/parse.rs | //! Read Rust code on stdin, print syntax tree on stdout.
use ide::Edition;
use syntax::{AstNode, SourceFile};
use crate::cli::{flags, read_stdin};
impl flags::Parse {
pub fn run(self) -> anyhow::Result<()> {
let _p = tracing::info_span!("flags::Parse::run").entered();
let text = read_stdin()?;
... | 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/rust-analyzer/src/cli/analysis_stats.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs | //! Fully type-check project and print various stats, like the number of type
//! errors.
use std::{
env, fmt,
ops::AddAssign,
panic::{AssertUnwindSafe, catch_unwind},
time::{SystemTime, UNIX_EPOCH},
};
use cfg::{CfgAtom, CfgDiff};
use hir::{
Adt, AssocItem, Crate, DefWithBody, FindPathConfig, Has... | 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/rust-analyzer/src/cli/unresolved_references.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/unresolved_references.rs | //! Reports references in code that the IDE layer cannot resolve.
use hir::{AnyDiagnostic, Crate, Module, Semantics, db::HirDatabase, sym};
use ide::{AnalysisHost, RootDatabase, TextRange};
use ide_db::{FxHashSet, LineIndexDatabase as _, base_db::SourceDatabase, defs::NameRefClass};
use load_cargo::{LoadCargoConfig, 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/rust-analyzer/src/cli/symbols.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/symbols.rs | //! Read Rust code on stdin, print syntax tree on stdout.
use ide::{Analysis, FileStructureConfig};
use crate::cli::{flags, read_stdin};
impl flags::Symbols {
pub fn run(self) -> anyhow::Result<()> {
let text = read_stdin()?;
let (analysis, file_id) = Analysis::from_single_file(text);
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/rust-analyzer/src/cli/flags.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/flags.rs | //! Grammar for the command-line arguments.
#![allow(unreachable_pub)]
use std::{path::PathBuf, str::FromStr};
use ide_ssr::{SsrPattern, SsrRule};
use crate::cli::Verbosity;
xflags::xflags! {
src "./src/cli/flags.rs"
/// LSP server for the Rust programming language.
///
/// Subcommands and their fla... | 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/rust-analyzer/src/cli/progress_report.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/progress_report.rs | //! A simple progress bar
//!
//! A single thread non-optimized progress bar
use std::io::{self, Write};
/// A Simple ASCII Progress Bar
pub(crate) struct ProgressReport<'a> {
curr: f32,
text: String,
hidden: bool,
len: usize,
pos: u64,
msg: Option<Box<dyn Fn() -> String + 'a>>,
}
impl<'a> 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/rust-analyzer/src/cli/lsif.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/lsif.rs | //! LSIF (language server index format) generator
use std::env;
use std::time::Instant;
use ide::{
Analysis, AnalysisHost, FileId, FileRange, MonikerKind, MonikerResult, PackageInformation,
RootDatabase, StaticIndex, StaticIndexedFile, TokenId, TokenStaticData,
VendoredLibrariesConfig,
};
use ide_db::{Lin... | 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/rust-analyzer/src/cli/rustc_tests.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/rustc_tests.rs | //! Run all tests in a project, similar to `cargo test`, but using the mir interpreter.
use std::convert::identity;
use std::thread::Builder;
use std::time::{Duration, Instant};
use std::{cell::RefCell, fs::read_to_string, panic::AssertUnwindSafe, path::PathBuf};
use hir::{ChangeWithProcMacros, Crate};
use ide::{Anal... | 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/rust-analyzer/src/cli/scip.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs | //! SCIP generator
use std::{path::PathBuf, time::Instant};
use ide::{
AnalysisHost, LineCol, Moniker, MonikerDescriptorKind, MonikerIdentifier, MonikerResult,
RootDatabase, StaticIndex, StaticIndexedFile, SymbolInformationKind, TextRange, TokenId,
TokenStaticData, VendoredLibrariesConfig,
};
use ide_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/rust-analyzer/src/cli/run_tests.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/run_tests.rs | //! Run all tests in a project, similar to `cargo test`, but using the mir interpreter.
use hir::{Crate, Module};
use hir_ty::db::HirDatabase;
use ide_db::{LineIndexDatabase, base_db::SourceDatabase};
use profile::StopWatch;
use project_model::{CargoConfig, RustLibSource};
use syntax::TextRange;
use load_cargo::{Load... | 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/rust-analyzer/src/cli/ssr.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/ssr.rs | //! Applies structured search replace rules from the command line.
use anyhow::Context;
use ide_db::{EditionedFileId, base_db::SourceDatabase};
use ide_ssr::MatchFinder;
use load_cargo::{LoadCargoConfig, ProcMacroServerChoice, load_workspace_at};
use project_model::{CargoConfig, RustLibSource};
use crate::cli::flags;... | 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/rust-analyzer/src/cli/prime_caches.rs | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/prime_caches.rs | //! Load the project and run cache priming.
//!
//! Unlike `analysis-stats`, this command is intended to be used for
//! benchmarking rust-analyzer's default startup configuration. It *does not*
//! attempt to simulate the full IDE experience through the lifetime of the
//! an editing session.
use load_cargo::{LoadCar... | 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/rust-analyzer/tests/slow-tests/support.rs | src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/support.rs | use std::{
cell::{Cell, RefCell},
env, fs,
sync::Once,
time::Duration,
};
use crossbeam_channel::{Receiver, after, select};
use itertools::Itertools;
use lsp_server::{Connection, Message, Notification, Request};
use lsp_types::{TextDocumentIdentifier, Url, notification::Exit, request::Shutdown};
use 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/rust-analyzer/tests/slow-tests/ratoml.rs | src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/ratoml.rs | use crate::support::{Project, Server};
use crate::testdir::TestDir;
use lsp_types::{
DidChangeTextDocumentParams, DidOpenTextDocumentParams, DidSaveTextDocumentParams,
TextDocumentContentChangeEvent, TextDocumentIdentifier, TextDocumentItem, Url,
VersionedTextDocumentIdentifier,
notification::{DidChange... | 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/rust-analyzer/tests/slow-tests/cli.rs | src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/cli.rs | use expect_test::expect;
use test_utils::skip_slow_tests;
use crate::support::Project;
// If you choose to change the test fixture here, please inform the ferrocene/needy maintainers by
// opening an issue at https://github.com/ferrocene/needy as the tool relies on specific token
// mapping behavior.
#[test]
fn lsif_... | 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/rust-analyzer/tests/slow-tests/testdir.rs | src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/testdir.rs | use std::{
fs, io,
sync::atomic::{AtomicUsize, Ordering},
};
use paths::{Utf8Path, Utf8PathBuf};
pub(crate) struct TestDir {
path: Utf8PathBuf,
keep: bool,
}
impl TestDir {
pub(crate) fn new() -> TestDir {
TestDir::new_dir(false)
}
pub(crate) fn new_symlink() -> TestDir {
... | 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/rust-analyzer/tests/slow-tests/main.rs | src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs | //! The most high-level integrated tests for rust-analyzer.
//!
//! This tests run a full LSP event loop, spawn cargo and process stdlib from
//! sysroot. For this reason, the tests here are very slow, and should be
//! avoided unless absolutely necessary.
//!
//! In particular, it's fine *not* to test that client & se... | 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/proc-macro-srv/build.rs | src/tools/rust-analyzer/crates/proc-macro-srv/build.rs | //! Determine rustc version `proc-macro-srv` (and thus the sysroot ABI) is
//! build with and make it accessible at runtime for ABI selection.
use std::{env, process::Command};
fn main() {
let rustc = env::var("RUSTC").expect("proc-macro-srv's build script expects RUSTC to be set");
#[allow(clippy::disallowed... | 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/proc-macro-srv/proc-macro-test/build.rs | src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/build.rs | //! This will build the proc macro in `imp`, and copy the resulting dylib artifact into the
//! `OUT_DIR`.
//!
//! `proc-macro-test` itself contains only a path to that artifact.
//!
//! The `PROC_MACRO_TEST_TOOLCHAIN` environment variable can be exported to use
//! a specific rustup toolchain: this allows testing agai... | 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/proc-macro-srv/proc-macro-test/imp/build.rs | src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/build.rs | //! This teaches cargo about our cfg(rust_analyzer)
fn main() {
println!("cargo:rustc-check-cfg=cfg(rust_analyzer)");
}
| 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/proc-macro-srv/proc-macro-test/imp/src/lib.rs | src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/src/lib.rs | //! Exports a few trivial procedural macros for testing.
#![feature(proc_macro_span, proc_macro_def_site)]
#![allow(clippy::all)]
use proc_macro::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree};
#[proc_macro]
pub fn fn_like_noop(args: TokenStream) -> TokenStream {
args
}
#[proc_macro]
pub fn fn_lik... | 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/proc-macro-srv/proc-macro-test/src/lib.rs | src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/src/lib.rs | //! Exports a few trivial procedural macros for testing.
pub static PROC_MACRO_TEST_LOCATION: &str = env!("PROC_MACRO_TEST_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/proc-macro-srv/src/token_stream.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/token_stream.rs | //! The proc-macro server token stream implementation.
use core::fmt;
use std::{mem, sync::Arc};
use intern::Symbol;
use proc_macro::Delimiter;
use rustc_lexer::{DocStyle, LiteralKind};
use crate::bridge::{DelimSpan, Group, Ident, LitKind, Literal, Punct, TokenTree};
/// Trait for allowing tests to parse tokenstrea... | 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/proc-macro-srv/src/lib.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs | //! RA Proc Macro Server
//!
//! This library is able to call compiled Rust custom derive dynamic libraries on arbitrary code.
//! The general idea here is based on <https://github.com/fedochet/rust-proc-macro-expander>.
//!
//! But we adapt it to better fit RA needs:
//!
//! * We use `tt` for proc-macro `TokenStream` ... | 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/proc-macro-srv/src/server_impl.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl.rs | //! proc-macro server implementation
//!
//! Based on idea from <https://github.com/fedochet/rust-proc-macro-expander>
//! The lib-proc-macro server backend is `TokenStream`-agnostic, such that
//! we could provide any TokenStream implementation.
//! The original idea from fedochet is using proc-macro2 as backend,
//! ... | 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/proc-macro-srv/src/dylib.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib.rs | //! Handles dynamic library loading for proc macro
mod proc_macros;
mod version;
use proc_macro::bridge;
use std::{fmt, fs, io, time::SystemTime};
use temp_dir::TempDir;
use libloading::Library;
use object::Object;
use paths::{Utf8Path, Utf8PathBuf};
use crate::{
PanicMessage, ProcMacroClientHandle, ProcMacroKi... | 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/proc-macro-srv/src/bridge.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/bridge.rs | //! `proc_macro::bridge` newtypes.
use proc_macro::bridge as pm_bridge;
pub use pm_bridge::{DelimSpan, Diagnostic, ExpnGlobals, LitKind};
pub type TokenTree<S> =
pm_bridge::TokenTree<crate::token_stream::TokenStream<S>, S, intern::Symbol>;
pub type Literal<S> = pm_bridge::Literal<S, intern::Symbol>;
pub type Gro... | 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/proc-macro-srv/src/dylib/version.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/version.rs | //! Reading proc-macro rustc version information from binary data
use std::io::{self, Read};
use object::read::{Object, ObjectSection};
#[derive(Debug)]
pub struct RustCInfo {
#[allow(dead_code)]
pub version: (usize, usize, usize),
#[allow(dead_code)]
pub channel: String,
#[allow(dead_code)]
... | 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/proc-macro-srv/src/dylib/proc_macros.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/proc_macros.rs | //! Proc macro ABI
use crate::{ProcMacroClientHandle, ProcMacroKind, ProcMacroSrvSpan, token_stream::TokenStream};
use proc_macro::bridge;
#[repr(transparent)]
pub(crate) struct ProcMacros([bridge::client::ProcMacro]);
impl From<bridge::PanicMessage> for crate::PanicMessage {
fn from(p: bridge::PanicMessage) -> 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/proc-macro-srv/src/tests/utils.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs | //! utils used in proc-macro tests
use expect_test::Expect;
use span::{
EditionedFileId, FileId, ROOT_ERASED_FILE_AST_ID, Span, SpanAnchor, SyntaxContext, TextRange,
};
use crate::{
EnvSnapshot, ProcMacroSrv, SpanId, dylib, proc_macro_test_dylib_path, token_stream::TokenStream,
};
fn parse_string(call_site: ... | 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/proc-macro-srv/src/tests/mod.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/mod.rs | //! proc-macro tests
#[macro_use]
mod utils;
use utils::*;
use expect_test::expect;
#[test]
fn test_derive_empty() {
assert_expand(
"DeriveEmpty",
r#"struct S { field: &'r#lt fn(u32) -> &'a r#u32 }"#,
expect![[r#"
IDENT 1 struct
IDENT 1 S
GROUP {} 1 1 1... | 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/proc-macro-srv/src/server_impl/token_id.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/token_id.rs | //! proc-macro server backend based on [`proc_macro_api::msg::SpanId`] as the backing span.
//! This backend is rather inflexible, used by RustRover and older rust-analyzer versions.
use std::{
collections::{HashMap, HashSet},
ops::{Bound, Range},
};
use intern::Symbol;
use proc_macro::bridge::server;
use 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/proc-macro-srv/src/server_impl/rust_analyzer_span.rs | src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs | //! proc-macro server backend based on rust-analyzer's internal span representation
//! This backend is used solely by rust-analyzer as it ties into rust-analyzer internals.
//!
//! It is an unfortunate result of how the proc-macro API works that we need to look into the
//! concrete representation of the spans, and 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/cfg/src/lib.rs | src/tools/rust-analyzer/crates/cfg/src/lib.rs | //! cfg defines conditional compiling options, `cfg` attribute parser and evaluator
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;
mod cfg_expr;
mod dnf;
#[cfg(test)]
mod tests;
use std::fmt;
use rustc_hash::FxHashSet;
use intern::{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/cfg/src/tests.rs | src/tools/rust-analyzer/crates/cfg/src/tests.rs | use arbitrary::{Arbitrary, Unstructured};
use expect_test::{Expect, expect};
use intern::Symbol;
use syntax::{
AstNode, Edition,
ast::{self, TokenTreeChildren},
};
use syntax_bridge::{
DocCommentDesugarMode,
dummy_test_span_utils::{DUMMY, DummyTestSpanMap},
syntax_node_to_token_tree,
};
use crate::... | 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/cfg/src/cfg_expr.rs | src/tools/rust-analyzer/crates/cfg/src/cfg_expr.rs | //! The condition expression used in `#[cfg(..)]` attributes.
//!
//! See: <https://doc.rust-lang.org/reference/conditional-compilation.html#conditional-compilation>
use std::fmt;
use intern::Symbol;
/// A simple configuration value passed in from the outside.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Cf... | 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/cfg/src/dnf.rs | src/tools/rust-analyzer/crates/cfg/src/dnf.rs | //! Disjunctive Normal Form construction.
//!
//! Algorithm from <https://www.cs.drexel.edu/~jjohnson/2015-16/fall/CS270/Lectures/3/dnf.pdf>,
//! which would have been much easier to read if it used pattern matching. It's also missing the
//! entire "distribute ANDs over ORs" part, which is not trivial. Oh well.
//!
//... | 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/proc-macro-api/src/lib.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs | //! Client-side Proc-Macro crate
//!
//! We separate proc-macro expanding logic to an extern program to allow
//! different implementations (e.g. wasm or dylib loading). And this crate
//! is used to provide basic infrastructure for communication between two
//! processes: Client (RA itself), Server (the external progr... | 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/proc-macro-api/src/process.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/process.rs | //! Handle process life-time and message passing for proc-macro client
use std::{
io::{self, BufRead, BufReader, Read, Write},
panic::AssertUnwindSafe,
process::{Child, ChildStdin, ChildStdout, Command, Stdio},
sync::{Arc, Mutex, OnceLock},
};
use paths::AbsPath;
use semver::Version;
use span::Span;
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/proc-macro-api/src/bidirectional_protocol.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol.rs | //! Bidirectional protocol methods
use std::{
io::{self, BufRead, Write},
sync::Arc,
};
use paths::AbsPath;
use span::Span;
use crate::{
Codec, ProcMacro, ProcMacroKind, ServerError,
bidirectional_protocol::msg::{
BidirectionalMessage, ExpandMacro, ExpandMacroData, ExpnGlobals, Request, Respo... | 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/proc-macro-api/src/legacy_protocol.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol.rs | //! The initial proc-macro-srv protocol, soon to be deprecated.
pub mod msg;
use std::{
io::{BufRead, Write},
sync::Arc,
};
use paths::AbsPath;
use span::Span;
use crate::{
ProcMacro, ProcMacroKind, ServerError,
legacy_protocol::msg::{
ExpandMacro, ExpandMacroData, ExpnGlobals, FlatTree, Mes... | 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/proc-macro-api/src/transport.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/transport.rs | //! Contains construct for transport of messages.
pub mod codec;
pub mod framing;
| 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/proc-macro-api/src/bidirectional_protocol/msg.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol/msg.rs | //! Bidirectional protocol messages
use paths::Utf8PathBuf;
use serde::{Deserialize, Serialize};
use crate::{
ProcMacroKind,
legacy_protocol::msg::{FlatTree, Message, PanicMessage, ServerConfig},
};
#[derive(Debug, Serialize, Deserialize)]
pub enum SubRequest {
SourceText { file_id: u32, start: u32, end:... | 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/proc-macro-api/src/transport/codec.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/transport/codec.rs | //! Protocol codec
use std::io;
use serde::de::DeserializeOwned;
use crate::transport::framing::Framing;
pub mod json;
pub mod postcard;
pub trait Codec: Framing {
fn encode<T: serde::Serialize>(msg: &T) -> io::Result<Self::Buf>;
fn decode<T: DeserializeOwned>(buf: &mut Self::Buf) -> io::Result<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/proc-macro-api/src/transport/framing.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/transport/framing.rs | //! Protocol framing
use std::io::{self, BufRead, Write};
pub trait Framing {
type Buf: Default + Send + Sync;
fn read<'a, R: BufRead + ?Sized>(
inp: &mut R,
buf: &'a mut Self::Buf,
) -> io::Result<Option<&'a mut Self::Buf>>;
fn write<W: Write + ?Sized>(out: &mut W, buf: &Self::Buf) ... | 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/proc-macro-api/src/transport/codec/json.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/transport/codec/json.rs | //! Protocol functions for json.
use std::io::{self, BufRead, Write};
use serde::{Serialize, de::DeserializeOwned};
use crate::{Codec, transport::framing::Framing};
pub struct JsonProtocol;
impl Framing for JsonProtocol {
type Buf = String;
fn read<'a, R: BufRead + ?Sized>(
inp: &mut R,
buf... | 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/proc-macro-api/src/transport/codec/postcard.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/transport/codec/postcard.rs | //! Postcard encode and decode implementations.
use std::io::{self, BufRead, Write};
use serde::{Serialize, de::DeserializeOwned};
use crate::{Codec, transport::framing::Framing};
pub struct PostcardProtocol;
impl Framing for PostcardProtocol {
type Buf = Vec<u8>;
fn read<'a, R: BufRead + ?Sized>(
... | 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/proc-macro-api/src/legacy_protocol/msg.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs | //! Defines messages for cross-process message passing based on `ndjson` wire protocol
pub(crate) mod flat;
pub use self::flat::*;
use std::io::{self, BufRead, Write};
use paths::Utf8PathBuf;
use serde::de::DeserializeOwned;
use serde_derive::{Deserialize, Serialize};
use crate::{Codec, ProcMacroKind};
/// Represen... | 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/proc-macro-api/src/legacy_protocol/msg/flat.rs | src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs | //! Serialization-friendly representation of `tt::TopSubtree`.
//!
//! It is possible to serialize `TopSubtree` recursively, as a tree, but using
//! arbitrary-nested trees in JSON is problematic, as they can cause the JSON
//! parser to overflow the stack.
//!
//! Additionally, such implementation would be pretty verb... | 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/paths/src/lib.rs | src/tools/rust-analyzer/crates/paths/src/lib.rs | //! Thin wrappers around [`camino::Utf8PathBuf`], distinguishing
//! between absolute and relative paths.
use std::{
borrow::Borrow,
ffi::OsStr,
fmt, ops,
path::{Path, PathBuf},
};
pub use camino::{Utf8Component, Utf8Components, Utf8Path, Utf8PathBuf, Utf8Prefix};
/// A [`Utf8PathBuf`] that is guaran... | 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/src/ted.rs | src/tools/rust-analyzer/crates/syntax/src/ted.rs | //! Primitive tree editor, ed for trees.
//!
//! The `_raw`-suffixed functions insert elements as is, unsuffixed versions fix
//! up elements around the edges.
use std::{mem, ops::RangeInclusive};
use parser::T;
use rowan::TextSize;
use crate::{
SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken,
ast::{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/syntax/src/ast.rs | src/tools/rust-analyzer/crates/syntax/src/ast.rs | //! Abstract Syntax Tree, layered on top of untyped `SyntaxNode`s
pub mod edit;
pub mod edit_in_place;
mod expr_ext;
mod generated;
pub mod make;
mod node_ext;
mod operators;
pub mod prec;
pub mod syntax_factory;
mod token_ext;
mod traits;
use std::marker::PhantomData;
use either::Either;
use crate::{
SyntaxKin... | 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/src/lib.rs | src/tools/rust-analyzer/crates/syntax/src/lib.rs | //! Syntax Tree library used throughout the rust-analyzer.
//!
//! Properties:
//! - easy and fast incremental re-parsing
//! - graceful handling of errors
//! - full-fidelity representation (*any* text can be precisely represented as
//! a syntax tree)
//!
//! For more information, see the [RFC]. Current imp... | 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/src/tests.rs | src/tools/rust-analyzer/crates/syntax/src/tests.rs | use std::{
fs,
path::{Path, PathBuf},
};
use ast::HasName;
use expect_test::expect_file;
use parser::Edition;
use rayon::prelude::*;
use stdx::format_to_acc;
use test_utils::{bench, bench_fixture, project_root};
use crate::{AstNode, SourceFile, SyntaxError, ast, fuzz};
#[test]
fn parse_smoke_test() {
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/syntax/src/fuzz.rs | src/tools/rust-analyzer/crates/syntax/src/fuzz.rs | //! Some infrastructure for fuzzy testing.
//!
//! We don't normally run fuzzying, so this is hopelessly bitrotten :(
use std::str::{self, FromStr};
use parser::Edition;
use crate::{AstNode, SourceFile, TextRange, validation};
fn check_file_invariants(file: &SourceFile) {
let root = file.syntax();
validatio... | 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/src/validation.rs | src/tools/rust-analyzer/crates/syntax/src/validation.rs | //! This module implements syntax validation that the parser doesn't handle.
//!
//! A failed validation emits a diagnostic.
mod block;
use itertools::Itertools;
use rowan::Direction;
use rustc_literal_escaper::{
EscapeError, unescape_byte, unescape_byte_str, unescape_c_str, unescape_char, unescape_str,
};
use 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/syntax/src/syntax_node.rs | src/tools/rust-analyzer/crates/syntax/src/syntax_node.rs | //! This module defines Concrete Syntax Tree (CST), used by rust-analyzer.
//!
//! The CST includes comments and whitespace, provides a single node type,
//! `SyntaxNode`, and a basic traversal API (parent, children, siblings).
//!
//! The *real* implementation is in the (language-agnostic) `rowan` crate, this
//! modu... | 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/src/algo.rs | src/tools/rust-analyzer/crates/syntax/src/algo.rs | //! Collection of assorted algorithms for syntax trees.
use itertools::Itertools;
use crate::{
AstNode, Direction, NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange,
TextSize, syntax_editor::Element,
};
/// Returns ancestors of the node at the offset, sorted by length. This should
//... | 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/src/utils.rs | src/tools/rust-analyzer/crates/syntax/src/utils.rs | //! A set of utils methods to reuse on other abstraction levels
use crate::SyntaxKind;
#[inline]
pub fn is_raw_identifier(name: &str, edition: parser::Edition) -> bool {
let is_keyword = SyntaxKind::from_keyword(name, edition).is_some();
is_keyword && !matches!(name, "self" | "crate" | "super" | "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/syntax/src/syntax_editor.rs | src/tools/rust-analyzer/crates/syntax/src/syntax_editor.rs | //! Syntax Tree editor
//!
//! Inspired by Roslyn's [`SyntaxEditor`], but is temporarily built upon mutable syntax tree editing.
//!
//! [`SyntaxEditor`]: https://github.com/dotnet/roslyn/blob/43b0b05cc4f492fd5de00f6f6717409091df8daa/src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs
use std::{
fmt, iter,
nu... | 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/src/syntax_error.rs | src/tools/rust-analyzer/crates/syntax/src/syntax_error.rs | //! See docs for `SyntaxError`.
use std::fmt;
use crate::{TextRange, TextSize};
/// Represents the result of unsuccessful tokenization, parsing
/// or tree validation.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct SyntaxError(String, TextRange);
// FIXME: there was an unused SyntaxErrorKind previously (be... | 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/src/token_text.rs | src/tools/rust-analyzer/crates/syntax/src/token_text.rs | //! Yet another version of owned string, backed by a syntax tree token.
use std::{cmp::Ordering, fmt, ops};
use rowan::GreenToken;
use smol_str::SmolStr;
pub struct TokenText<'a>(pub(crate) Repr<'a>);
pub(crate) enum Repr<'a> {
Borrowed(&'a str),
Owned(GreenToken),
}
impl<'a> TokenText<'a> {
pub fn bor... | 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/src/parsing.rs | src/tools/rust-analyzer/crates/syntax/src/parsing.rs | //! Lexing, bridging to parser (which does the actual parsing) and
//! incremental reparsing.
mod reparsing;
use rowan::TextRange;
use crate::{SyntaxError, SyntaxTreeBuilder, syntax_node::GreenNode};
pub(crate) use crate::parsing::reparsing::incremental_reparse;
pub(crate) fn parse_text(text: &str, edition: parser... | 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/src/ptr.rs | src/tools/rust-analyzer/crates/syntax/src/ptr.rs | //! In rust-analyzer, syntax trees are transient objects.
//!
//! That means that we create trees when we need them, and tear them down to
//! save memory. In this architecture, hanging on to a particular syntax node
//! for a long time is ill-advisable, as that keeps the whole tree resident.
//!
//! Instead, we provid... | 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/src/hacks.rs | src/tools/rust-analyzer/crates/syntax/src/hacks.rs | //! Things which exist to solve practical issues, but which shouldn't exist.
//!
//! Please avoid adding new usages of the functions in this module
use parser::Edition;
use crate::{AstNode, ast};
pub fn parse_expr_from_str(s: &str, edition: Edition) -> Option<ast::Expr> {
let s = s.trim();
let file = ast::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/src/validation/block.rs | src/tools/rust-analyzer/crates/syntax/src/validation/block.rs | //! Logic for validating block expressions i.e. `ast::BlockExpr`.
use crate::{
SyntaxError,
SyntaxKind::*,
ast::{self, AstNode, HasAttrs},
};
pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
if let Some(parent) = block.syntax().parent() {
match parent.k... | 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/src/parsing/reparsing.rs | src/tools/rust-analyzer/crates/syntax/src/parsing/reparsing.rs | //! Implementation of incremental re-parsing.
//!
//! We use two simple strategies for this:
//! - if the edit modifies only a single token (like changing an identifier's
//! letter), we replace only this token.
//! - otherwise, we search for the nearest `{}` block which contains the edit
//! and try to 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/syntax/src/ast/prec.rs | src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs | //! Precedence representation.
use stdx::always;
use crate::{
AstNode, Direction, SyntaxNode, T,
algo::skip_trivia_token,
ast::{self, BinaryOp, Expr, HasArgList, RangeItem},
match_ast,
};
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub enum ExprPrecedence {
// return, break, continue, yi... | 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/src/ast/operators.rs | src/tools/rust-analyzer/crates/syntax/src/ast/operators.rs | //! Defines a bunch of data-less enums for unary and binary operators.
//!
//! Types here don't know about AST, this allows re-using them for both AST and
//! HIR.
use std::fmt;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum RangeOp {
/// `..`
Exclusive,
/// `..=`
Inclusive,
}
#[derive(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/syntax/src/ast/syntax_factory.rs | src/tools/rust-analyzer/crates/syntax/src/ast/syntax_factory.rs | //! Builds upon [`crate::ast::make`] constructors to create ast fragments with
//! optional syntax mappings.
//!
//! Instead of forcing make constructors to perform syntax mapping, we instead
//! let [`SyntaxFactory`] handle constructing the mappings. Care must be taken
//! to remember to feed the syntax mappings into ... | 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/src/ast/make.rs | src/tools/rust-analyzer/crates/syntax/src/ast/make.rs | //! This module contains free-standing functions for creating AST fragments out
//! of smaller pieces.
//!
//! Note that all functions here intended to be stupid constructors, which just
//! assemble a finish node from immediate children. If you want to do something
//! smarter than that, it belongs to the `ext` submod... | 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/src/ast/edit_in_place.rs | src/tools/rust-analyzer/crates/syntax/src/ast/edit_in_place.rs | //! Structural editing for ast.
use std::iter::{empty, once, successors};
use parser::{SyntaxKind, T};
use crate::{
AstNode, AstToken, Direction, SyntaxElement,
SyntaxKind::{ATTR, COMMENT, WHITESPACE},
SyntaxNode, SyntaxToken,
algo::{self, neighbor},
ast::{self, HasGenericParams, edit::IndentLeve... | 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/src/ast/edit.rs | src/tools/rust-analyzer/crates/syntax/src/ast/edit.rs | //! This module contains functions for editing syntax trees. As the trees are
//! immutable, all function here return a fresh copy of the tree, instead of
//! doing an in-place modification.
use std::{fmt, iter, ops};
use crate::{
AstToken, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken,
ast::{self, AstNo... | 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/src/ast/node_ext.rs | src/tools/rust-analyzer/crates/syntax/src/ast/node_ext.rs | //! Various extension methods to ast Nodes, which are hard to code-generate.
//! Extensions for various expressions live in a sibling `expr_extensions` module.
//!
//! These methods should only do simple, shallow tasks related to the syntax of the node itself.
use std::{borrow::Cow, fmt, iter::successors};
use iterto... | 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/src/ast/token_ext.rs | src/tools/rust-analyzer/crates/syntax/src/ast/token_ext.rs | //! There are many AstNodes, but only a few tokens, so we hand-write them here.
use std::ops::Range;
use std::{borrow::Cow, num::ParseIntError};
use rustc_literal_escaper::{
EscapeError, MixedUnit, unescape_byte, unescape_byte_str, unescape_c_str, unescape_char,
unescape_str,
};
use stdx::always;
use crate::... | 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/src/ast/traits.rs | src/tools/rust-analyzer/crates/syntax/src/ast/traits.rs | //! Various traits that are implemented by ast nodes.
//!
//! The implementations are usually trivial, and live in generated.rs
use either::Either;
use crate::{
SyntaxElement, SyntaxNode, SyntaxToken, T,
ast::{self, AstChildren, AstNode, AstToken, support},
match_ast,
syntax_node::SyntaxElementChildren... | 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/src/ast/expr_ext.rs | src/tools/rust-analyzer/crates/syntax/src/ast/expr_ext.rs | //! Various extension methods to ast Expr Nodes, which are hard to code-generate.
//!
//! These methods should only do simple, shallow tasks related to the syntax of the node itself.
use crate::{
AstToken,
SyntaxKind::{self, *},
SyntaxNode, SyntaxToken, T,
ast::{
self, ArgList, AstChildren, Ast... | 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/src/ast/generated.rs | src/tools/rust-analyzer/crates/syntax/src/ast/generated.rs | //! This file is actually hand-written, but the submodules are indeed generated.
#[rustfmt::skip]
pub(crate) mod nodes;
#[rustfmt::skip]
pub(crate) mod tokens;
use crate::{
AstNode,
SyntaxKind::{self, *},
SyntaxNode,
};
pub(crate) use nodes::*;
// Stmt is the only nested enum, so it's easier to just hand... | 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/src/ast/make/quote.rs | src/tools/rust-analyzer/crates/syntax/src/ast/make/quote.rs | //! A `quote!`-like API for crafting AST nodes.
pub(crate) use rowan::{GreenNode, GreenToken, NodeOrToken, SyntaxKind as RSyntaxKind};
macro_rules! quote_impl_ {
( @append $children:ident ) => {}; // Base case.
( @append $children:ident
$node:ident {
$($tree:tt)*
}
$($rest... | 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/src/ast/syntax_factory/constructors.rs | src/tools/rust-analyzer/crates/syntax/src/ast/syntax_factory/constructors.rs | //! Wrappers over [`make`] constructors
use crate::{
AstNode, NodeOrToken, SyntaxKind, SyntaxNode, SyntaxToken,
ast::{
self, HasArgList, HasAttrs, HasGenericArgs, HasGenericParams, HasLoopBody, HasName,
HasTypeBounds, HasVisibility, RangeItem, make,
},
syntax_editor::SyntaxMappingBuilder... | 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/src/ast/generated/tokens.rs | src/tools/rust-analyzer/crates/syntax/src/ast/generated/tokens.rs | //! Generated by `cargo xtask codegen grammar`, do not edit by hand.
use crate::{
SyntaxKind::{self, *},
SyntaxToken,
ast::AstToken,
};
use std::{fmt, hash};
pub struct Byte {
pub(crate) syntax: SyntaxToken,
}
impl std::fmt::Display for Byte {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::... | 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/src/ast/generated/nodes.rs | src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs | //! Generated by `cargo xtask codegen grammar`, do not edit by hand.
#![allow(non_snake_case)]
use crate::{
SyntaxKind::{self, *},
SyntaxNode, SyntaxToken, T,
ast::{self, AstChildren, AstNode, support},
};
use std::{fmt, hash};
pub struct Abi {
pub(crate) syntax: SyntaxNode,
}
impl Abi {
#[inline]
... | 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/src/syntax_editor/mapping.rs | src/tools/rust-analyzer/crates/syntax/src/syntax_editor/mapping.rs | //! Maps syntax elements through disjoint syntax nodes.
//!
//! [`SyntaxMappingBuilder`] should be used to create mappings to add to a [`SyntaxEditor`]
use itertools::Itertools;
use rustc_hash::FxHashMap;
use crate::{SyntaxElement, SyntaxNode};
#[derive(Debug, Default)]
pub struct SyntaxMapping {
// important in... | 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/src/syntax_editor/edits.rs | src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edits.rs | //! Structural editing for ast using `SyntaxEditor`
use crate::{
AstToken, Direction, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, T,
algo::neighbor,
ast::{
self, AstNode, Fn, GenericParam, HasGenericParams, HasName, edit::IndentLevel, make,
syntax_factory::SyntaxFactory,
},
... | 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/src/syntax_editor/edit_algo.rs | src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edit_algo.rs | //! Implementation of applying changes to a syntax tree.
use std::{
cmp::Ordering,
collections::VecDeque,
ops::{Range, RangeInclusive},
};
use rowan::TextRange;
use rustc_hash::FxHashMap;
use stdx::format_to;
use crate::{
SyntaxElement, SyntaxNode, SyntaxNodePtr,
syntax_editor::{Change, ChangeKin... | 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/fuzz/fuzz_targets/parser.rs | src/tools/rust-analyzer/crates/syntax/fuzz/fuzz_targets/parser.rs | //! Fuzzing for from-scratch parsing.
#![no_main]
use libfuzzer_sys::fuzz_target;
use syntax::fuzz::check_parser;
fuzz_target!(|data: &[u8]| {
if let Ok(text) = std::str::from_utf8(data) {
check_parser(text)
}
});
| 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/fuzz/fuzz_targets/reparse.rs | src/tools/rust-analyzer/crates/syntax/fuzz/fuzz_targets/reparse.rs | //! Fuzzing for incremental parsing.
#![no_main]
use libfuzzer_sys::fuzz_target;
use syntax::fuzz::CheckReparse;
fuzz_target!(|data: &[u8]| {
if let Some(check) = CheckReparse::from_data(data) {
check.run();
}
});
| 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/test_data/reparse/fuzz-failures/0003.rs | src/tools/rust-analyzer/crates/syntax/test_data/reparse/fuzz-failures/0003.rs | 0
1
__ | 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/test_data/reparse/fuzz-failures/0004.rs | src/tools/rust-analyzer/crates/syntax/test_data/reparse/fuzz-failures/0004.rs | 0
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/syntax/test_data/reparse/fuzz-failures/0001.rs | src/tools/rust-analyzer/crates/syntax/test_data/reparse/fuzz-failures/0001.rs | 0
1
bb" | 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.