Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c0ecf1a
Implement Span::line() and Span::column() for proc-macro server
tilladam Jan 2, 2026
fd1457d
Merge pull request #21405 from tilladam/master
Veykril Jan 5, 2026
4fbc520
perf: Re-use scratch allocations for `try_evaluate_obligations`
Veykril Jan 5, 2026
978d75e
Merge pull request #21407 from Veykril/push-wlvmrkvowrlr
Veykril Jan 5, 2026
a978fdc
fix: use crates where ADT was defined in deref_chain of trait_applica…
sshcrack Jan 6, 2026
6cc9e5c
Document `Query`
Veykril Jan 7, 2026
1af7813
Document `WithFixture`
Veykril Jan 7, 2026
ad02093
feat: Allow rust paths in symbol search
Veykril Jan 7, 2026
dc64aef
fix: Properly lower `SelfOnly` predicates
ShoyuVanilla Jan 4, 2026
74c3f3a
Merge pull request #21414 from sshcrack/master
ShoyuVanilla Jan 7, 2026
e2b5072
Add ProjectJsonTargetSpec.project_root
cormacrelf Dec 2, 2025
ff94498
project-model: Helpers for traversing dep graph in ProjectJson
cormacrelf Dec 2, 2025
3083bde
project-model: Don't do O(n) clones as well as O(n) search
cormacrelf Dec 2, 2025
ac64177
project-model: Return crate by reference
cormacrelf Sep 4, 2024
3b97d38
Fix misuse of ?
cormacrelf Dec 2, 2025
327ea18
flycheck: Make the flycheckable unit a flycheck::PackageSpecifier enum
cormacrelf Sep 4, 2024
95a07db
project-model: Introduce RunnableKind::Flycheck
cormacrelf Sep 4, 2024
2a899bb
flycheck: Use RunnableKind::Flycheck from ProjectJson to flycheck
cormacrelf Sep 4, 2024
7f608da
flycheck: Support {label} in check_overrideCommand as well as $saved_…
cormacrelf Sep 4, 2024
4e61c60
flycheck: Always flycheck single crate if there is a build label from…
cormacrelf Sep 4, 2024
778de45
flycheck: Add display_command to pretty-print flycheck command being …
cormacrelf Sep 4, 2024
53a371c
flycheck: notifications show full command when configured in a rust-p…
cormacrelf Sep 4, 2024
3fdb78c
flycheck: Rename FlycheckConfig::CargoCommand to Automatic
cormacrelf Dec 3, 2025
2d58177
Fix RunnableKind::Run label interpolation
cormacrelf Dec 3, 2025
71e2ded
doc: Update docs for runnables to include run/flycheck
cormacrelf Dec 3, 2025
422597f
doc: make example for workspace.discoverConfig actually work
cormacrelf Dec 3, 2025
f06a6b9
doc: overhaul non-cargo build system docs
cormacrelf Dec 3, 2025
b02e975
Fix hir-ty clippy issue
cormacrelf Jan 7, 2026
be1e357
Merge pull request #21399 from ShoyuVanilla/self-only-preds
ChayimFriedman2 Jan 7, 2026
6a9de22
Prepare for merging from rust-lang/rust
invalid-email-address Jan 8, 2026
ef09e5a
Merge ref '548e586795f6' from rust-lang/rust
invalid-email-address Jan 8, 2026
edd9143
Merge pull request #21419 from rust-lang/rustc-pull
lnicola Jan 8, 2026
bca6a93
Merge pull request #18043 from cormacrelf/feature/rust-project-discovery
Veykril Jan 8, 2026
5d8a7da
Fixes for builtin derive expansions
ChayimFriedman2 Jan 8, 2026
8dcf0a5
Merge pull request #21421 from ChayimFriedman2/no-derive-register
ChayimFriedman2 Jan 8, 2026
0e95932
Publish smol_str v0.3.5
ChayimFriedman2 Jan 8, 2026
1b7bcc2
Merge pull request #21422 from ChayimFriedman2/new-smol-str
ChayimFriedman2 Jan 8, 2026
26be33a
Fix not disable string escape highlights
A4-Tacks Jan 8, 2026
baa605d
Merge pull request #21420 from A4-Tacks/disable-string-hl
ChayimFriedman2 Jan 9, 2026
42a79a1
Fix lifetimes len diagnostics for fn pointers
ChayimFriedman2 Jan 9, 2026
b33aee1
internal: Include private definitions in generated rustdoc
Wilfred Jan 9, 2026
91c1df2
Merge pull request #21433 from Wilfred/rustdoc_private_items
ChayimFriedman2 Jan 9, 2026
7b9c564
Remove code made redundant by method resolution rewrite
ChayimFriedman2 Jan 9, 2026
2d06703
Fix issue with ignore attribute for tests where the attribute has a v…
cry-inc Jan 9, 2026
ab042a8
Merge pull request #21432 from ChayimFriedman2/fn-ptr-lifetime-diag
ShoyuVanilla Jan 10, 2026
c825a50
Cleanup
Veykril Jan 10, 2026
90b4d52
Merge pull request #21415 from Veykril/push-qusurvyqwmxt
Veykril Jan 10, 2026
020e383
Merge pull request #21434 from ChayimFriedman2/traits-mix
ShoyuVanilla Jan 10, 2026
2780e8c
Abstract proc-macro-srv input and output away
Veykril Jan 10, 2026
11b26c1
Merge pull request #21438 from Veykril/push-prppzzzllqso
Veykril Jan 10, 2026
f09e344
internal: Landing integration test infra for proc-macro-srv-cli
Veykril Jan 10, 2026
209e08e
Merge pull request #21436 from cry-inc/bugfix/fix-ignore-attribute-wi…
ChayimFriedman2 Jan 10, 2026
c8266ae
add byte range subrequest/response
Shourya742 Jan 7, 2026
a4d1be0
update proc-macro-srv to include byte-range
Shourya742 Jan 7, 2026
c42413f
add byte range to main loop and direct the request via callback and d…
Shourya742 Jan 7, 2026
e1e9b93
add comment on incrementality of subrequest
Shourya742 Jan 8, 2026
4ea1679
add write read imports
Shourya742 Jan 11, 2026
e15140c
Merge pull request #21416 from Shourya742/2026-01-07-add-byte-range
Veykril Jan 11, 2026
9dea565
Prepare for merging from rust-lang/rust
invalid-email-address Jan 12, 2026
4de328e
Merge ref '44a5b55557c2' from rust-lang/rust
invalid-email-address Jan 12, 2026
af640fc
Format code
invalid-email-address Jan 12, 2026
d8303c0
Merge pull request #21439 from Veykril/push-okkmmxmnwyxm
Veykril Jan 12, 2026
e3ad299
Create a new `SymbolKind::CrateRoot`
Veykril Jan 12, 2026
8e1eb14
Fix crate root search in world symbols duplicating root entries
Veykril Jan 12, 2026
b4c1ba3
Merge pull request #21446 from Veykril/veykril/push-wnuyntxqruqm
Veykril Jan 12, 2026
3e5bf97
Merge pull request #21444 from rust-lang/rustc-pull
lnicola Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/.github/workflows/rustdoc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: rustup update --no-self-update stable

- name: Build Documentation
run: cargo doc --all --no-deps
run: cargo doc --all --no-deps --document-private-items

- name: Deploy Docs
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
Expand Down
9 changes: 8 additions & 1 deletion src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,7 @@ dependencies = [
"intern",
"libc",
"libloading",
"line-index 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap2",
"object",
"paths",
Expand All @@ -1878,9 +1879,15 @@ name = "proc-macro-srv-cli"
version = "0.0.0"
dependencies = [
"clap",
"expect-test",
"intern",
"paths",
"postcard",
"proc-macro-api",
"proc-macro-srv",
"proc-macro-test",
"span",
"tt",
]

[[package]]
Expand Down Expand Up @@ -2628,7 +2635,7 @@ dependencies = [

[[package]]
name = "smol_str"
version = "0.3.4"
version = "0.3.5"
dependencies = [
"arbitrary",
"borsh",
Expand Down
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/crates/hir-def/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ fn match_attr_flags(attr_flags: &mut AttrFlags, attr: Meta) -> ControlFlow<Infal
match attr {
Meta::NamedKeyValue { name: Some(name), value, .. } => match name.text() {
"deprecated" => attr_flags.insert(AttrFlags::IS_DEPRECATED),
"ignore" => attr_flags.insert(AttrFlags::IS_IGNORE),
"lang" => attr_flags.insert(AttrFlags::LANG_ITEM),
"path" => attr_flags.insert(AttrFlags::HAS_PATH),
"unstable" => attr_flags.insert(AttrFlags::IS_UNSTABLE),
Expand Down
22 changes: 21 additions & 1 deletion src/tools/rust-analyzer/crates/hir-def/src/builtin_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use intern::{Symbol, sym};
use tt::TextRange;

use crate::{
AdtId, BuiltinDeriveImplId, BuiltinDeriveImplLoc, FunctionId, HasModule, db::DefDatabase,
AdtId, BuiltinDeriveImplId, BuiltinDeriveImplLoc, FunctionId, HasModule, MacroId,
db::DefDatabase, lang_item::LangItems,
};

macro_rules! declare_enum {
Expand Down Expand Up @@ -86,6 +87,25 @@ declare_enum!(
DispatchFromDyn => [],
);

impl BuiltinDeriveImplTrait {
pub fn derive_macro(self, lang_items: &LangItems) -> Option<MacroId> {
match self {
BuiltinDeriveImplTrait::Copy => lang_items.CopyDerive,
BuiltinDeriveImplTrait::Clone => lang_items.CloneDerive,
BuiltinDeriveImplTrait::Default => lang_items.DefaultDerive,
BuiltinDeriveImplTrait::Debug => lang_items.DebugDerive,
BuiltinDeriveImplTrait::Hash => lang_items.HashDerive,
BuiltinDeriveImplTrait::Ord => lang_items.OrdDerive,
BuiltinDeriveImplTrait::PartialOrd => lang_items.PartialOrdDerive,
BuiltinDeriveImplTrait::Eq => lang_items.EqDerive,
BuiltinDeriveImplTrait::PartialEq => lang_items.PartialEqDerive,
BuiltinDeriveImplTrait::CoerceUnsized | BuiltinDeriveImplTrait::DispatchFromDyn => {
lang_items.CoercePointeeDerive
}
}
}
}

impl BuiltinDeriveImplMethod {
pub fn trait_method(
self,
Expand Down
10 changes: 6 additions & 4 deletions src/tools/rust-analyzer/crates/hir-def/src/dyn_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
pub mod keys {
use std::marker::PhantomData;

use either::Either;
use hir_expand::{MacroCallId, attrs::AttrId};
use rustc_hash::FxHashMap;
use syntax::{AstNode, AstPtr, ast};

use crate::{
BlockId, ConstId, EnumId, EnumVariantId, ExternBlockId, ExternCrateId, FieldId, FunctionId,
ImplId, LifetimeParamId, Macro2Id, MacroRulesId, ProcMacroId, StaticId, StructId, TraitId,
TypeAliasId, TypeOrConstParamId, UnionId, UseId,
BlockId, BuiltinDeriveImplId, ConstId, EnumId, EnumVariantId, ExternBlockId, ExternCrateId,
FieldId, FunctionId, ImplId, LifetimeParamId, Macro2Id, MacroRulesId, ProcMacroId,
StaticId, StructId, TraitId, TypeAliasId, TypeOrConstParamId, UnionId, UseId,
dyn_map::{DynMap, Policy},
};

Expand Down Expand Up @@ -71,7 +72,8 @@ pub mod keys {
(
AttrId,
/* derive() */ MacroCallId,
/* actual derive macros */ Box<[Option<MacroCallId>]>,
/* actual derive macros */
Box<[Option<Either<MacroCallId, BuiltinDeriveImplId>>]>,
),
> = Key::new();

Expand Down
19 changes: 14 additions & 5 deletions src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use std::{fmt, sync::LazyLock};

use base_db::Crate;
use either::Either;
use hir_expand::{AstId, MacroCallId, attrs::AttrId, name::Name};
use indexmap::map::Entry;
use itertools::Itertools;
Expand Down Expand Up @@ -199,7 +200,7 @@ struct DeriveMacroInvocation {
attr_id: AttrId,
/// The `#[derive]` call
attr_call_id: MacroCallId,
derive_call_ids: SmallVec<[Option<MacroCallId>; 4]>,
derive_call_ids: SmallVec<[Option<Either<MacroCallId, BuiltinDeriveImplId>>; 4]>,
}

pub(crate) static BUILTIN_SCOPE: LazyLock<FxIndexMap<Name, PerNs>> = LazyLock::new(|| {
Expand Down Expand Up @@ -345,7 +346,9 @@ impl ItemScope {
pub fn all_macro_calls(&self) -> impl Iterator<Item = MacroCallId> + '_ {
self.macro_invocations.values().copied().chain(self.attr_macros.values().copied()).chain(
self.derive_macros.values().flat_map(|it| {
it.iter().flat_map(|it| it.derive_call_ids.iter().copied().flatten())
it.iter().flat_map(|it| {
it.derive_call_ids.iter().copied().flatten().flat_map(|it| it.left())
})
}),
)
}
Expand Down Expand Up @@ -379,6 +382,10 @@ impl ItemScope {
self.types.get(name).map(|item| (item.def, item.vis))
}

pub(crate) fn makro(&self, name: &Name) -> Option<MacroId> {
self.macros.get(name).map(|item| item.def)
}

/// XXX: this is O(N) rather than O(1), try to not introduce new usages.
pub(crate) fn name_of(&self, item: ItemInNs) -> Option<(&Name, Visibility, /*declared*/ bool)> {
match item {
Expand Down Expand Up @@ -519,7 +526,7 @@ impl ItemScope {
pub(crate) fn set_derive_macro_invoc(
&mut self,
adt: AstId<ast::Adt>,
call: MacroCallId,
call: Either<MacroCallId, BuiltinDeriveImplId>,
id: AttrId,
idx: usize,
) {
Expand All @@ -539,7 +546,7 @@ impl ItemScope {
adt: AstId<ast::Adt>,
attr_id: AttrId,
attr_call_id: MacroCallId,
mut derive_call_ids: SmallVec<[Option<MacroCallId>; 4]>,
mut derive_call_ids: SmallVec<[Option<Either<MacroCallId, BuiltinDeriveImplId>>; 4]>,
) {
derive_call_ids.shrink_to_fit();
self.derive_macros.entry(adt).or_default().push(DeriveMacroInvocation {
Expand All @@ -554,7 +561,9 @@ impl ItemScope {
) -> impl Iterator<
Item = (
AstId<ast::Adt>,
impl Iterator<Item = (AttrId, MacroCallId, &[Option<MacroCallId>])>,
impl Iterator<
Item = (AttrId, MacroCallId, &[Option<Either<MacroCallId, BuiltinDeriveImplId>>]),
>,
),
> + '_ {
self.derive_macros.iter().map(|(k, v)| {
Expand Down
54 changes: 48 additions & 6 deletions src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use intern::{Symbol, sym};
use stdx::impl_from;

use crate::{
AdtId, AssocItemId, AttrDefId, Crate, EnumId, EnumVariantId, FunctionId, ImplId, ModuleDefId,
StaticId, StructId, TraitId, TypeAliasId, UnionId,
AdtId, AssocItemId, AttrDefId, Crate, EnumId, EnumVariantId, FunctionId, ImplId, MacroId,
ModuleDefId, StaticId, StructId, TraitId, TypeAliasId, UnionId,
attrs::AttrFlags,
db::DefDatabase,
nameres::{DefMap, assoc::TraitItems, crate_def_map, crate_local_def_map},
Expand Down Expand Up @@ -99,7 +99,7 @@ pub fn crate_lang_items(db: &dyn DefDatabase, krate: Crate) -> Option<Box<LangIt
}

if matches!(krate.data(db).origin, base_db::CrateOrigin::Lang(base_db::LangCrateOrigin::Core)) {
lang_items.fill_non_lang_core_traits(db, crate_def_map);
lang_items.fill_non_lang_core_items(db, crate_def_map);
}

if lang_items.is_empty() { None } else { Some(Box::new(lang_items)) }
Expand Down Expand Up @@ -169,6 +169,27 @@ fn resolve_core_trait(
Some(trait_)
}

fn resolve_core_macro(
db: &dyn DefDatabase,
core_def_map: &DefMap,
modules: &[Symbol],
name: Symbol,
) -> Option<MacroId> {
let mut current = &core_def_map[core_def_map.root];
for module in modules {
let Some((ModuleDefId::ModuleId(cur), _)) =
current.scope.type_(&Name::new_symbol_root(module.clone()))
else {
return None;
};
if cur.krate(db) != core_def_map.krate() || cur.block(db) != core_def_map.block_id() {
return None;
}
current = &core_def_map[cur];
}
current.scope.makro(&Name::new_symbol_root(name))
}

#[salsa::tracked(returns(as_deref))]
pub(crate) fn crate_notable_traits(db: &dyn DefDatabase, krate: Crate) -> Option<Box<[TraitId]>> {
let mut traits = Vec::new();
Expand All @@ -195,7 +216,11 @@ macro_rules! language_item_table {

@non_lang_core_traits:

$( core::$($non_lang_module:ident)::*, $non_lang_trait:ident; )*
$( core::$($non_lang_trait_module:ident)::*, $non_lang_trait:ident; )*

@non_lang_core_macros:

$( core::$($non_lang_macro_module:ident)::*, $non_lang_macro:ident, $non_lang_macro_field:ident; )*
) => {
#[allow(non_snake_case)] // FIXME: Should we remove this?
#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)]
Expand All @@ -207,6 +232,9 @@ macro_rules! language_item_table {
$(
pub $non_lang_trait: Option<TraitId>,
)*
$(
pub $non_lang_macro_field: Option<MacroId>,
)*
}

impl LangItems {
Expand All @@ -218,6 +246,7 @@ macro_rules! language_item_table {
fn merge_prefer_self(&mut self, other: &Self) {
$( self.$lang_item = self.$lang_item.or(other.$lang_item); )*
$( self.$non_lang_trait = self.$non_lang_trait.or(other.$non_lang_trait); )*
$( self.$non_lang_macro_field = self.$non_lang_macro_field.or(other.$non_lang_macro_field); )*
}

fn assign_lang_item(&mut self, name: Symbol, target: LangItemTarget) {
Expand All @@ -233,8 +262,9 @@ macro_rules! language_item_table {
}
}

fn fill_non_lang_core_traits(&mut self, db: &dyn DefDatabase, core_def_map: &DefMap) {
$( self.$non_lang_trait = resolve_core_trait(db, core_def_map, &[ $(sym::$non_lang_module),* ], sym::$non_lang_trait); )*
fn fill_non_lang_core_items(&mut self, db: &dyn DefDatabase, core_def_map: &DefMap) {
$( self.$non_lang_trait = resolve_core_trait(db, core_def_map, &[ $(sym::$non_lang_trait_module),* ], sym::$non_lang_trait); )*
$( self.$non_lang_macro_field = resolve_core_macro(db, core_def_map, &[ $(sym::$non_lang_macro_module),* ], sym::$non_lang_macro); )*
}
}

Expand Down Expand Up @@ -479,4 +509,16 @@ language_item_table! { LangItems =>
core::hash, Hash;
core::cmp, Ord;
core::cmp, Eq;

@non_lang_core_macros:
core::default, Default, DefaultDerive;
core::fmt, Debug, DebugDerive;
core::hash, Hash, HashDerive;
core::cmp, PartialOrd, PartialOrdDerive;
core::cmp, Ord, OrdDerive;
core::cmp, PartialEq, PartialEqDerive;
core::cmp, Eq, EqDerive;
core::marker, CoercePointee, CoercePointeeDerive;
core::marker, Copy, CopyDerive;
core::clone, Clone, CloneDerive;
}
12 changes: 7 additions & 5 deletions src/tools/rust-analyzer/crates/hir-def/src/nameres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ mod tests;
use std::ops::{Deref, DerefMut, Index, IndexMut};

use base_db::Crate;
use either::Either;
use hir_expand::{
EditionedFileId, ErasedAstId, HirFileId, InFile, MacroCallId, mod_path::ModPath, name::Name,
proc_macro::ProcMacroKind,
Expand All @@ -75,8 +76,8 @@ use triomphe::Arc;
use tt::TextRange;

use crate::{
AstId, BlockId, BlockLoc, ExternCrateId, FunctionId, FxIndexMap, Lookup, MacroCallStyles,
MacroExpander, MacroId, ModuleId, ModuleIdLt, ProcMacroId, UseId,
AstId, BlockId, BlockLoc, BuiltinDeriveImplId, ExternCrateId, FunctionId, FxIndexMap, Lookup,
MacroCallStyles, MacroExpander, MacroId, ModuleId, ModuleIdLt, ProcMacroId, UseId,
db::DefDatabase,
item_scope::{BuiltinShadowMode, ItemScope},
item_tree::TreeId,
Expand Down Expand Up @@ -192,7 +193,8 @@ pub struct DefMap {
/// Tracks which custom derives are in scope for an item, to allow resolution of derive helper
/// attributes.
// FIXME: Figure out a better way for the IDE layer to resolve these?
derive_helpers_in_scope: FxHashMap<AstId<ast::Item>, Vec<(Name, MacroId, MacroCallId)>>,
derive_helpers_in_scope:
FxHashMap<AstId<ast::Item>, Vec<(Name, MacroId, Either<MacroCallId, BuiltinDeriveImplId>)>>,
/// A mapping from [`hir_expand::MacroDefId`] to [`crate::MacroId`].
pub macro_def_to_macro_id: FxHashMap<ErasedAstId, MacroId>,

Expand All @@ -214,7 +216,7 @@ struct DefMapCrateData {
registered_tools: Vec<Symbol>,
/// Unstable features of Rust enabled with `#![feature(A, B)]`.
unstable_features: FxHashSet<Symbol>,
/// #[rustc_coherence_is_core]
/// `#[rustc_coherence_is_core]`
rustc_coherence_is_core: bool,
no_core: bool,
no_std: bool,
Expand Down Expand Up @@ -540,7 +542,7 @@ impl DefMap {
pub fn derive_helpers_in_scope(
&self,
id: AstId<ast::Adt>,
) -> Option<&[(Name, MacroId, MacroCallId)]> {
) -> Option<&[(Name, MacroId, Either<MacroCallId, BuiltinDeriveImplId>)]> {
self.derive_helpers_in_scope.get(&id.map(|it| it.upcast())).map(Deref::deref)
}

Expand Down
Loading
Loading