Repository: rust-lang/rust-analyzer
Pull request #17961 (2024-08-25 11:11:21)

internal: Don't allocate autoderef steps when not needed


Patch:
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index d5951a9420..2ccdc8c042 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -7,9 +7,10 @@
 # prettier format
 f247090558c9ba3c551566eae5882b7ca865225f
 
-# subtree syncs
-932d85b52946d917deab2c23ead552f7f713b828
+# pre-josh subtree syncs
 3e358a6827d83e8d6473913a5e304734aadfed04
+932d85b52946d917deab2c23ead552f7f713b828
 9d2cb42a413e51deb50b36794a2e1605381878fc
-f532576ac53ddcc666bc8d59e0b6437065e2f599
+b2f6fd4f961fc7e4fbfdb80cae2e6065f8436f15
 c48062fe2ab9a2d913d1985a6b0aec4bf936bfc1
+f532576ac53ddcc666bc8d59e0b6437065e2f599
diff --git a/crates/base-db/src/input.rs b/crates/base-db/src/input.rs
index b67f4c7a0c..3616fa9fd8 100644
--- a/crates/base-db/src/input.rs
+++ b/crates/base-db/src/input.rs
@@ -272,7 +272,6 @@ impl ReleaseChannel {
     }
 }
 
-#[non_exhaustive]
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct CrateData {
     pub root_file_id: FileId,
diff --git a/crates/hir-def/src/data.rs b/crates/hir-def/src/data.rs
index c62f2f8733..d17ebd7ff9 100644
--- a/crates/hir-def/src/data.rs
+++ b/crates/hir-def/src/data.rs
@@ -748,9 +748,8 @@ impl<'a> AssocItemCollector<'a> {
                     &AstIdWithPath::new(file_id, ast_id, Clone::clone(path)),
                     ctxt,
                     expand_to,
-                    self.expander.module,
+                    self.expander.krate(),
                     resolver,
-                    |module| module.def_map(self.db).path_for_module(self.db, module),
                 ) {
                     Ok(Some(call_id)) => {
                         let res =
diff --git a/crates/hir-def/src/expander.rs b/crates/hir-def/src/expander.rs
index 57bd54ed17..6d8b4445f7 100644
--- a/crates/hir-def/src/expander.rs
+++ b/crates/hir-def/src/expander.rs
@@ -69,12 +69,9 @@ impl Expander {
 
         let result = self.within_limit(db, |this| {
             let macro_call = this.in_file(&macro_call);
-            match macro_call.as_call_id(
-                db.upcast(),
-                this.module,
-                |path| resolver(path).map(|it| db.macro_def(it)),
-                |module| this.module.def_map(db).path_for_module(db, module),
-            ) {
+            match macro_call.as_call_id_with_errors(db.upcast(), this.module.krate(), |path| {
+                resolver(path).map(|it| db.macro_def(it))
+            }) {
                 Ok(call_id) => call_id,
                 Err(resolve_err) => {
                     unresolved_macro_err = Some(resolve_err);
diff --git a/crates/hir-def/src/lib.rs b/crates/hir-def/src/lib.rs
index eb235f9b9f..0213bd904b 100644
--- a/crates/hir-def/src/lib.rs
+++ b/crates/hir-def/src/lib.rs
@@ -77,7 +77,7 @@ use base_db::{
 use hir_expand::{
     builtin::{BuiltinAttrExpander, BuiltinDeriveExpander, BuiltinFnLikeExpander, EagerExpander},
     db::ExpandDatabase,
-    eager::{expand_eager_macro_input, expand_module_path_as_eager},
+    eager::expand_eager_macro_input,
     impl_intern_lookup,
     name::Name,
     proc_macro::{CustomProcMacroExpander, ProcMacroKind},
@@ -1400,19 +1400,26 @@ pub trait AsMacroCall {
     fn as_call_id(
         &self,
         db: &dyn ExpandDatabase,
-        module: ModuleId,
+        krate: CrateId,
+        resolver: impl Fn(&path::ModPath) -> Option<MacroDefId> + Copy,
+    ) -> Option<MacroCallId> {
+        self.as_call_id_with_errors(db, krate, resolver).ok()?.value
+    }
+
+    fn as_call_id_with_errors(
+        &self,
+        db: &dyn ExpandDatabase,
+        krate: CrateId,
         resolver: impl Fn(&path::ModPath) -> Option<MacroDefId> + Copy,
-        mod_path: impl FnOnce(ModuleId) -> String,
     ) -> Result<ExpandResult<Option<MacroCallId>>, UnresolvedMacro>;
 }
 
 impl AsMacroCall for InFile<&ast::MacroCall> {
-    fn as_call_id(
+    fn as_call_id_with_errors(
         &self,
         db: &dyn ExpandDatabase,
-        module: ModuleId,
+        krate: CrateId,
         resolver: impl Fn(&path::ModPath) -> Option<MacroDefId> + Copy,
-        mod_path: impl FnOnce(ModuleId) -> String,
     ) -> Result<ExpandResult<Option<MacroCallId>>, UnresolvedMacro> {
         let expands_to = hir_expand::ExpandTo::from_call_site(self.value);
         let ast_id = AstId::new(self.file_id, db.ast_id_map(self.file_id).ast_id(self.value));
@@ -1439,10 +1446,9 @@ impl AsMacroCall for InFile<&ast::MacroCall> {
             &path,
             call_site.ctx,
             expands_to,
-            module,
+            krate,
             resolver,
             resolver,
-            mod_path,
         )
     }
 }
@@ -1469,9 +1475,8 @@ fn macro_call_as_call_id(
     call: &AstIdWithPath<ast::MacroCall>,
     call_site: SyntaxContextId,
     expand_to: ExpandTo,
-    module: ModuleId,
+    krate: CrateId,
     resolver: impl Fn(&path::ModPath) -> Option<MacroDefId> + Copy,
-    mod_path: impl FnOnce(ModuleId) -> String,
 ) -> Result<Option<MacroCallId>, UnresolvedMacro> {
     macro_call_as_call_id_with_eager(
         db,
@@ -1479,10 +1484,9 @@ fn macro_call_as_call_id(
         &call.path,
         call_site,
         expand_to,
-        module,
+        krate,
         resolver,
         resolver,
-        mod_path,
     )
     .map(|res| res.value)
 }
@@ -1493,26 +1497,16 @@ fn macro_call_as_call_id_with_eager(
     path: &path::ModPath,
     call_site: SyntaxContextId,
     expand_to: ExpandTo,
-    module: ModuleId,
+    krate: CrateId,
     resolver: impl FnOnce(&path::ModPath) -> Option<MacroDefId>,
     eager_resolver: impl Fn(&path::ModPath) -> Option<MacroDefId>,
-    mod_path: impl FnOnce(ModuleId) -> String,
 ) -> Result<ExpandResult<Option<MacroCallId>>, UnresolvedMacro> {
     let def = resolver(path).ok_or_else(|| UnresolvedMacro { path: path.clone() })?;
 
     let res = match def.kind {
-        MacroDefKind::BuiltInEager(_, EagerExpander::ModulePath) => expand_module_path_as_eager(
-            db,
-            module.krate,
-            mod_path(module),
-            &ast_id.to_node(db),
-            ast_id,
-            def,
-            call_site,
-        ),
         MacroDefKind::BuiltInEager(..) => expand_eager_macro_input(
             db,
-            module.krate,
+            krate,
             &ast_id.to_node(db),
             ast_id,
             def,
@@ -1522,7 +1516,7 @@ fn macro_call_as_call_id_with_eager(
         _ if def.is_fn_like() => ExpandResult {
             value: Some(def.make_call(
                 db,
-                module.krate,
+                krate,
                 MacroCallKind::FnLike { ast_id, expand_to, eager: None },
                 call_site,
             )),
diff --git a/crates/hir-def/src/nameres.rs b/crates/hir-def/src/nameres.rs
index db45f6bed6..11601c683e 100644
--- a/crates/hir-def/src/nameres.rs
+++ b/crates/hir-def/src/nameres.rs
@@ -63,7 +63,7 @@ use base_db::CrateId;
 use hir_expand::{
     name::Name, proc_macro::ProcMacroKind, ErasedAstId, HirFileId, InFile, MacroCallId, MacroDefId,
 };
-use intern::{sym, Symbol};
+use intern::Symbol;
 use itertools::Itertools;
 use la_arena::Arena;
 use rustc_hash::{FxHashMap, FxHashSet};
@@ -139,7 +139,6 @@ pub struct DefMap {
 /// Data that belongs to a crate which is shared between a crate's def map and all its block def maps.
 #[derive(Clone, Debug, PartialEq, Eq)]
 struct DefMapCrateData {
-    crate_name: Option<Symbol>,
     /// The extern prelude which contains all root modules of external crates that are in scope.
     extern_prelude: FxIndexMap<Name, (CrateRootModuleId, Option<ExternCrateId>)>,
 
@@ -165,7 +164,6 @@ struct DefMapCrateData {
 impl DefMapCrateData {
     fn new(edition: Edition) -> Self {
         Self {
-            crate_name: None,
             extern_prelude: FxIndexMap::default(),
             exported_derives: FxHashMap::default(),
             fn_proc_macro_mapping: FxHashMap::default(),
@@ -188,7 +186,6 @@ impl DefMapCrateData {
             registered_attrs,
             registered_tools,
             unstable_features,
-            crate_name: _,
             rustc_coherence_is_core: _,
             no_core: _,
             no_std: _,
@@ -446,28 +443,6 @@ impl DefMap {
         self.modules.iter()
     }
 
-    pub fn path_for_module(&self, db: &dyn DefDatabase, mut module: ModuleId) -> String {
-        debug_assert!(module.krate == self.krate && module.block == self.block.map(|b| b.block));
-        let mut parts = vec![];
-        if let Some(name) = module.name(db) {
-            parts.push(name.symbol().clone());
-        }
-        while let Some(parent) = module.def_map(db).containing_module(module.local_id) {
-            module = parent;
-            if let Some(name) = module.name(db) {
-                parts.push(name.symbol().clone());
-            }
-            if parts.len() > 10 {
-                break;
-            }
-        }
-        parts.push(match &self.data.crate_name {
-            Some(name) => name.clone(),
-            None => sym::crate_.clone(),
-        });
-        parts.into_iter().rev().format("::").to_string()
-    }
-
     pub fn derive_helpers_in_scope(
         &self,
         id: AstId<ast::Adt>,
diff --git a/crates/hir-def/src/nameres/collector.rs b/crates/hir-def/src/nameres/collector.rs
index 30df6c206d..22eb5a174d 100644
--- a/crates/hir-def/src/nameres/collector.rs
+++ b/crates/hir-def/src/nameres/collector.rs
@@ -247,23 +247,18 @@ impl DefCollector<'_> {
         let _p = tracing::info_span!("seed_with_top_level").entered();
 
         let crate_graph = self.db.crate_graph();
-        let crate_data = Arc::get_mut(&mut self.def_map.data).unwrap();
-        crate_data.crate_name = crate_graph[self.def_map.krate]
-            .display_name
-            .as_ref()
-            .map(|it| it.crate_name().symbol().clone());
-
         let file_id = crate_graph[self.def_map.krate].root_file_id();
         let item_tree = self.db.file_item_tree(file_id.into());
         let attrs = item_tree.top_level_attrs(self.db, self.def_map.krate);
+        let crate_data = Arc::get_mut(&mut self.def_map.data).unwrap();
 
-        let mut crate_cged_out = false;
+        let mut process = true;
 
         // Process other crate-level attributes.
         for attr in &*attrs {
             if let Some(cfg) = attr.cfg() {
                 if self.cfg_options.check(&cfg) == Some(false) {
-                    crate_cged_out = true;
+                    process = false;
                     break;
                 }
             }
@@ -277,11 +272,6 @@ impl DefCollector<'_> {
                         }
                     }
                 }
-                () if *attr_name == sym::crate_name.clone() => {
-                    if let Some(name) = attr.string_value().cloned() {
-                        crate_data.crate_name = Some(name);
-                    }
-                }
                 () if *attr_name == sym::crate_type.clone() => {
                     if attr.string_value() == Some(&sym::proc_dash_macro) {
                         self.is_proc_macro = true;
@@ -347,7 +337,7 @@ impl DefCollector<'_> {
 
         self.inject_prelude();
 
-        if crate_cged_out {
+        if !process {
             return;
         }
 
@@ -1217,9 +1207,8 @@ impl DefCollector<'_> {
                         ast_id,
                         *call_site,
                         *expand_to,
-                        self.def_map.module_id(directive.module_id),
+                        self.def_map.krate,
                         resolver_def_id,
-                        |module| self.def_map.path_for_module(self.db, module),
                     );
                     if let Ok(Some(call_id)) = call_id {
                         self.def_map.modules[directive.module_id]
@@ -1497,7 +1486,7 @@ impl DefCollector<'_> {
                         ast_id,
                         *call_site,
                         *expand_to,
-                        self.def_map.module_id(directive.module_id),
+                        self.def_map.krate,
                         |path| {
                             let resolved_res = self.def_map.resolve_path_fp_with_macro(
                                 self.db,
@@ -1509,7 +1498,6 @@ impl DefCollector<'_> {
                             );
                             resolved_res.resolved_def.take_macros().map(|it| self.db.macro_def(it))
                         },
-                        |module| self.def_map.path_for_module(self.db, module),
                     );
                     if let Err(UnresolvedMacro { path }) = macro_call_as_call_id {
                         self.def_map.diagnostics.push(DefDiagnostic::unresolved_macro_call(
@@ -2363,7 +2351,7 @@ impl ModCollector<'_, '_> {
             &ast_id.path,
             ctxt,
             expand_to,
-            self.def_collector.def_map.module_id(self.module_id),
+            self.def_collector.def_map.krate,
             |path| {
                 path.as_ident().and_then(|name| {
                     let def_map = &self.def_collector.def_map;
@@ -2393,7 +2381,6 @@ impl ModCollector<'_, '_> {
                 );
                 resolved_res.resolved_def.take_macros().map(|it| db.macro_def(it))
             },
-            |module| self.def_collector.def_map.path_for_module(self.def_collector.db, module),
         ) {
             // FIXME: if there were errors, this might've been in the eager expansion from an
             // unresolved macro, so we need to push this into late macro resolution. see fixme above
diff --git a/crates/hir-expand/src/builtin.rs b/crates/hir-expand/src/builtin.rs
index 7b9cb4e793..252430e4e9 100644
--- a/crates/hir-expand/src/builtin.rs
+++ b/crates/hir-expand/src/builtin.rs
@@ -1,6 +1,6 @@
 //! Builtin macros and attributes
 #[macro_use]
-pub(crate) mod quote;
+mod quote;
 
 mod attr_macro;
 mod derive_macro;
diff --git a/crates/hir-expand/src/builtin/fn_macro.rs b/crates/hir-expand/src/builtin/fn_macro.rs
index e4d09ddb3a..795d9b14df 100644
--- a/crates/hir-expand/src/builtin/fn_macro.rs
+++ b/crates/hir-expand/src/builtin/fn_macro.rs
@@ -116,6 +116,7 @@ register_builtin! {
     (column, Column) => line_expand,
     (file, File) => file_expand,
     (line, Line) => line_expand,
+    (module_path, ModulePath) => module_path_expand,
     (assert, Assert) => assert_expand,
     (stringify, Stringify) => stringify_expand,
     (llvm_asm, LlvmAsm) => asm_expand,
@@ -141,10 +142,7 @@ register_builtin! {
     (include_bytes, IncludeBytes) => include_bytes_expand,
     (include_str, IncludeStr) => include_str_expand,
     (env, Env) => env_expand,
-    (option_env, OptionEnv) => option_env_expand,
-    // This isn't really eager, we have no inputs, but we abuse the fact how eager macros are
-    // handled in r-a to be able to thread the module path through.
-    (module_path, ModulePath) => module_path_expand
+    (option_env, OptionEnv) => option_env_expand
 }
 
 fn mk_pound(span: Span) -> tt::Subtree {
@@ -159,6 +157,18 @@ fn mk_pound(span: Span) -> tt::Subtree {
     )
 }
 
+fn module_path_expand(
+    _db: &dyn ExpandDatabase,
+    _id: MacroCallId,
+    _tt: &tt::Subtree,
+    span: Span,
+) -> ExpandResult<tt::Subtree> {
+    // Just return a dummy result.
+    ExpandResult::ok(quote! {span =>
+         "module::path"
+    })
+}
+
 fn line_expand(
     _db: &dyn ExpandDatabase,
     _id: MacroCallId,
@@ -894,18 +904,6 @@ fn option_env_expand(
     ExpandResult::ok(expanded)
 }
 
-fn module_path_expand(
-    _db: &dyn ExpandDatabase,
-    _id: MacroCallId,
-    tt: &tt::Subtree,
-    span: Span,
-) -> ExpandResult<tt::Subtree> {
-    // Note: The actual implementation of this is in crates\hir-expand\src\eager.rs
-    ExpandResult::ok(quote! {span =>
-         #tt
-    })
-}
-
 fn quote_expand(
     _db: &dyn ExpandDatabase,
     _arg_id: MacroCallId,
diff --git a/crates/hir-expand/src/builtin/quote.rs b/crates/hir-expand/src/builtin/quote.rs
index 0c895056c2..5c33f817f9 100644
--- a/crates/hir-expand/src/builtin/quote.rs
+++ b/crates/hir-expand/src/builtin/quote.rs
@@ -128,7 +128,7 @@ macro_rules! quote_impl__ {
         }
     };
 }
-pub(crate) use quote_impl__ as __quote;
+pub(super) use quote_impl__ as __quote;
 
 /// FIXME:
 /// It probably should implement in proc-macro
@@ -137,7 +137,7 @@ macro_rules! quote_impl {
         $crate::builtin::quote::IntoTt::to_subtree($crate::builtin::quote::__quote!($span $($tt)*), $span)
     }
 }
-pub(crate) use quote_impl as quote;
+pub(super) use quote_impl as quote;
 
 pub(crate) trait IntoTt {
     fn to_subtree(self, span: Span) -> crate::tt::Subtree;
diff --git a/crates/hir-expand/src/eager.rs b/crates/hir-expand/src/eager.rs
index 534d566386..1dadfe2ba9 100644
--- a/crates/hir-expand/src/eager.rs
+++ b/crates/hir-expand/src/eager.rs
@@ -32,51 +32,6 @@ use crate::{
     MacroCallId, MacroCallKind, MacroCallLoc, MacroDefId, MacroDefKind,
 };
 
-pub fn expand_module_path_as_eager(
-    db: &dyn ExpandDatabase,
-    krate: CrateId,
-    mod_path: String,
-    macro_call: &ast::MacroCall,
-    ast_id: AstId<ast::MacroCall>,
-    def: MacroDefId,
-    call_site: SyntaxContextId,
-) -> ExpandResult<Option<MacroCallId>> {
-    let expand_to = ExpandTo::from_call_site(macro_call);
-
-    // Note:
-    // When `lazy_expand` is called, its *parent* file must already exist.
-    // Here we store an eager macro id for the argument expanded subtree
-    // for that purpose.
-    let arg_id = MacroCallLoc {
-        def,
-        krate,
-        kind: MacroCallKind::FnLike { ast_id, expand_to: ExpandTo::Expr, eager: None },
-        ctxt: call_site,
-    }
-    .intern(db);
-    #[allow(deprecated)] // builtin eager macros are never derives
-    let (_, _, span) = db.macro_arg(arg_id);
-    let subtree = crate::builtin::quote::quote! {span => #mod_path};
-
-    let loc = MacroCallLoc {
-        def,
-        krate,
-        kind: MacroCallKind::FnLike {
-            ast_id,
-            expand_to,
-            eager: Some(Arc::new(EagerCallInfo {
-                arg: Arc::new(subtree),
-                arg_id,
-                error: None,
-                span,
-            })),
-        },
-        ctxt: call_site,
-    };
-
-    ExpandResult { value: Some(loc.intern(db)), err: None }
-}
-
 pub fn expand_eager_macro_input(
     db: &dyn ExpandDatabase,
     krate: CrateId,
diff --git a/crates/hir-ty/src/autoderef.rs b/crates/hir-ty/src/autoderef.rs
index ecfc1ff99e..7a3846df40 100644
--- a/crates/hir-ty/src/autoderef.rs
+++ b/crates/hir-ty/src/autoderef.rs
@@ -3,6 +3,8 @@
 //! reference to a type with the field `bar`. This is an approximation of the
 //! logic in rustc (which lives in rustc_hir_analysis/check/autoderef.rs).
 
+use std::mem;
+
 use chalk_ir::cast::Cast;
 use hir_def::lang_item::LangItem;
 use hir_expand::name::Name;
@@ -37,7 +39,7 @@ pub fn autoderef(
 ) -> impl Iterator<Item = Ty> {
     let mut table = InferenceTable::new(db, env);
     let ty = table.instantiate_canonical(ty);
-    let mut autoderef = Autoderef::new(&mut table, ty, false);
+    let mut autoderef = Autoderef::new_no_tracking(&mut table, ty, false);
     let mut v = Vec::new();
     while let Some((ty, _steps)) = autoderef.next() {
         // `ty` may contain unresolved inference variables. Since there's no chance they would be
@@ -58,41 +60,76 @@ pub fn autoderef(
     v.into_iter()
 }
 
+trait TrackAutoderefSteps {
+    fn len(&self) -> usize;
+    fn push(&mut self, kind: AutoderefKind, ty: &Ty);
+}
+
+impl TrackAutoderefSteps for usize {
+    fn len(&self) -> usize {
+        *self
+    }
+    fn push(&mut self, _: AutoderefKind, _: &Ty) {
+        *self += 1;
+    }
+}
+impl TrackAutoderefSteps for Vec<(AutoderefKind, Ty)> {
+    fn len(&self) -> usize {
+        self.len()
+    }
+    fn push(&mut self, kind: AutoderefKind, ty: &Ty) {
+        self.push((kind, ty.clone()));
+    }
+}
+
 #[derive(Debug)]
-pub(crate) struct Autoderef<'a, 'db> {
-    pub(crate) table: &'a mut InferenceTable<'db>,
+pub(crate) struct Autoderef<'table, 'db, T = Vec<(AutoderefKind, Ty)>> {
+    pub(crate) table: &'table mut InferenceTable<'db>,
     ty: Ty,
     at_start: bool,
-    steps: Vec<(AutoderefKind, Ty)>,
+    steps: T,
     explicit: bool,
 }
 
-impl<'a, 'db> Autoderef<'a, 'db> {
-    pub(crate) fn new(table: &'a mut InferenceTable<'db>, ty: Ty, explicit: bool) -> Self {
+impl<'table, 'db> Autoderef<'table, 'db> {
+    pub(crate) fn new(table: &'table mut InferenceTable<'db>, ty: Ty, explicit: bool) -> Self {
         let ty = table.resolve_ty_shallow(&ty);
         Autoderef { table, ty, at_start: true, steps: Vec::new(), explicit }
     }
 
-    pub(crate) fn step_count(&self) -> usize {
-        self.steps.len()
-    }
-
     pub(crate) fn steps(&self) -> &[(AutoderefKind, Ty)] {
         &self.steps
     }
+}
+
+impl<'table, 'db> Autoderef<'table, 'db, usize> {
+    pub(crate) fn new_no_tracking(
+        table: &'table mut InferenceTable<'db>,
+        ty: Ty,
+        explicit: bool,
+    ) -> Self {
+        let ty = table.resolve_ty_shallow(&ty);
+        Autoderef { table, ty, at_start: true, steps: 0, explicit }
+    }
+}
+
+#[allow(private_bounds)]
+impl<'table, 'db, T: TrackAutoderefSteps> Autoderef<'table, 'db, T> {
+    pub(crate) fn step_count(&self) -> usize {
+        self.steps.len()
+    }
 
     pub(crate) fn final_ty(&self) -> Ty {
         self.ty.clone()
     }
 }
 
-impl Iterator for Autoderef<'_, '_> {
+impl<T: TrackAutoderefSteps> Iterator for Autoderef<'_, '_, T> {
     type Item = (Ty, usize);
 
     #[tracing::instrument(skip_all)]
     fn next(&mut self) -> Option<Self::Item> {
-        if self.at_start {
-            self.at_start = false;
+        if mem::take(&mut self.at_start) {
             return Some((self.ty.clone(), 0));
         }
 
@@ -102,7 +139,7 @@ impl Iterator for Autoderef<'_, '_> {
 
         let (kind, new_ty) = autoderef_step(self.table, self.ty.clone(), self.explicit)?;
 
-        self.steps.push((kind, self.ty.clone()));
+        self.steps.push(kind, &self.ty);
         self.ty = new_ty;
 
         Some((self.ty.clone(), self.step_count()))
@@ -129,12 +166,8 @@ pub(crate) fn builtin_deref<'ty>(
     match ty.kind(Interner) {
         TyKind::Ref(.., ty) => Some(ty),
         TyKind::Raw(.., ty) if explicit => Some(ty),
-        &TyKind::Adt(chalk_ir::AdtId(adt), ref substs) => {
-            if crate::lang_items::is_box(db, adt) {
-                substs.at(Interner, 0).ty(Interner)
-            } else {
-                None
-            }
+        &TyKind::Adt(chalk_ir::AdtId(adt), ref substs) if crate::lang_items::is_box(db, adt) => {
+            substs.at(Interner, 0).ty(Interner)
         }
         _ => None,
     }
diff --git a/crates/hir-ty/src/lower.rs b/crates/hir-ty/src/lower.rs
index 370d9ba99c..58c34cbd9e 100644
--- a/crates/hir-ty/src/lower.rs
+++ b/crates/hir-ty/src/lower.rs
@@ -1743,39 +1743,15 @@ fn implicitly_sized_clauses<'a, 'subst: 'a>(
     substitution: &'subst Substitution,
     resolver: &Resolver,
 ) -> Option<impl Iterator<Item = WhereClause> + Captures<'a> + Captures<'subst>> {
+    let is_trait_def = matches!(def, GenericDefId::TraitId(..));
+    let generic_args = &substitution.as_slice(Interner)[is_trait_def as usize..];
     let sized_trait = db
         .lang_item(resolver.krate(), LangItem::Sized)
-        .and_then(|lang_item| lang_item.as_trait().map(to_chalk_trait_id))?;
+        .and_then(|lang_item| lang_item.as_trait().map(to_chalk_trait_id));
 
-    let get_trait_self_idx = |container: ItemContainerId| {
-        if matches!(container, ItemContainerId::TraitId(_)) {
-            let generics = generics(db.upcast(), def);
-            Some(generics.len_self())
-        } else {
-            None
-        }
-    };
-    let trait_self_idx = match def {
-        GenericDefId::TraitId(_) => Some(0),
-        GenericDefId::FunctionId(it) => get_trait_self_idx(it.lookup(db.upcast()).container),
-        GenericDefId::ConstId(it) => get_trait_self_idx(it.lookup(db.upcast()).container),
-        GenericDefId::TypeAliasId(it) => get_trait_self_idx(it.lookup(db.upcast()).container),
-        _ => None,
-    };
-
-    Some(
-        substitution
-            .iter(Interner)
-            .enumerate()
-            .filter_map(
-                move |(idx, generic_arg)| {
-                    if Some(idx) == trait_self_idx {
-                        None
-                    } else {
-                        Some(generic_arg)
-                    }
-                },
-            )
+    sized_trait.map(move |sized_trait| {
+        generic_args
+            .iter()
             .filter_map(|generic_arg| generic_arg.ty(Interner))
             .filter(move |&self_ty| !explicitly_unsized_tys.contains(self_ty))
             .map(move |self_ty| {
@@ -1783,8 +1759,8 @@ fn implicitly_sized_clauses<'a, 'subst: 'a>(
                     trait_id: sized_trait,
                     substitution: Substitution::from1(Interner, self_ty.clone()),
                 })
-            }),
-    )
+            })
+    })
 }
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs
index d08f9b7ff0..5a72b97653 100644
--- a/crates/hir-ty/src/method_resolution.rs
+++ b/crates/hir-ty/src/method_resolution.rs
@@ -1067,7 +1067,7 @@ fn iterate_method_candidates_by_receiver(
     // be found in any of the derefs of receiver_ty, so we have to go through
     // that, including raw derefs.
     table.run_in_snapshot(|table| {
-        let mut autoderef = autoderef::Autoderef::new(table, receiver_ty.clone(), true);
+        let mut autoderef = autoderef::Autoderef::new_no_tracking(table, receiver_ty.clone(), true);
         while let Some((self_ty, _)) = autoderef.next() {
             iterate_inherent_methods(
                 &self_ty,
@@ -1082,7 +1082,7 @@ fn iterate_method_candidates_by_receiver(
         ControlFlow::Continue(())
     })?;
     table.run_in_snapshot(|table| {
-        let mut autoderef = autoderef::Autoderef::new(table, receiver_ty.clone(), true);
+        let mut autoderef = autoderef::Autoderef::new_no_tracking(table, receiver_ty.clone(), true);
         while let Some((self_ty, _)) = autoderef.next() {
             if matches!(self_ty.kind(Interner), TyKind::InferenceVar(_, TyVariableKind::General)) {
                 // don't try to resolve methods on unknown types
@@ -1657,7 +1657,7 @@ fn autoderef_method_receiver(
     ty: Ty,
 ) -> Vec<(Canonical<Ty>, ReceiverAdjustments)> {
     let mut deref_chain: Vec<_> = Vec::new();
-    let mut autoderef = autoderef::Autoderef::new(table, ty, false);
+    let mut autoderef = autoderef::Autoderef::new_no_tracking(table, ty, false);
     while let Some((ty, derefs)) = autoderef.next() {
         deref_chain.push((
             autoderef.table.canonicalize(ty),
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 1d7ab5f6b7..763f53031e 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -365,6 +365,7 @@ impl<'db> SemanticsImpl<'db> {
                 _,
                 BuiltinFnLikeExpander::Column
                     | BuiltinFnLikeExpander::File
+                    | BuiltinFnLikeExpander::ModulePath
                     | BuiltinFnLikeExpander::Asm
                     | BuiltinFnLikeExpander::LlvmAsm
                     | BuiltinFnLikeExpander::GlobalAsm
@@ -482,26 +483,10 @@ impl<'db> SemanticsImpl<'db> {
         let SourceAnalyzer { file_id, resolver, .. } =
             self.analyze_no_infer(actual_macro_call.syntax())?;
         let macro_call = InFile::new(file_id, actual_macro_call);
-        let macro_call_id = macro_call
-            .as_call_id(
-                self.db.upcast(),
-                resolver.module(),
-                |path| {
-                    resolver.resolve_path_as_macro_def(
-                        self.db.upcast(),
-                        path,
-                        Some(MacroSubNs::Bang),
-                    )
-                },
-                |module| {
-                    resolver
-                        .module()
-                        .def_map(self.db.upcast())
-                        .path_for_module(self.db.upcast(), module)
-                },
-            )
-            .ok()?
-            .value?;
+        let krate = resolver.krate();
+        let macro_call_id = macro_call.as_call_id(self.db.upcast(), krate, |path| {
+            resolver.resolve_path_as_macro_def(self.db.upcast(), path, Some(MacroSubNs::Bang))
+        })?;
         hir_expand::db::expand_speculative(
             self.db.upcast(),
             macro_call_id,
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index fe1d5b5764..be0116862b 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -839,25 +839,12 @@ impl SourceAnalyzer {
         db: &dyn HirDatabase,
         macro_call: InFile<&ast::MacroCall>,
     ) -> Option<MacroFileId> {
+        let krate = self.resolver.krate();
         // FIXME: This causes us to parse, generally this is the wrong approach for resolving a
         // macro call to a macro call id!
-        let macro_call_id = macro_call
-            .as_call_id(
-                db.upcast(),
-                self.resolver.module(),
-                |path| {
-                    self.resolver.resolve_path_as_macro_def(
-                        db.upcast(),
-                        path,
-                        Some(MacroSubNs::Bang),
-                    )
-                },
-                |module| {
-                    self.resolver.module().def_map(db.upcast()).path_for_module(db.upcast(), module)
-                },
-            )
-            .ok()?
-            .value?;
+        let macro_call_id = macro_call.as_call_id(db.upcast(), krate, |path| {
+            self.resolver.resolve_path_as_macro_def(db.upcast(), path, Some(MacroSubNs::Bang))
+        })?;
         // why the 64?
         Some(macro_call_id.as_macro_file()).filter(|it| it.expansion_level(db.upcast()) < 64)
     }
diff --git a/crates/ide-db/src/search.rs b/crates/ide-db/src/search.rs
index 12ce5a403f..c807a5940d 100644
--- a/crates/ide-db/src/search.rs
+++ b/crates/ide-db/src/search.rs
@@ -528,10 +528,6 @@ impl<'a> FindUsages<'a> {
         search_scope: &SearchScope,
         name: &str,
     ) -> bool {
-        if self.scope.is_some() {
-            return false;
-        }
-
         let _p = tracing::info_span!("short_associated_function_fast_search").entered();
 
         let container = (|| {
diff --git a/crates/ide/src/goto_type_definition.rs b/crates/ide/src/goto_type_definition.rs
index 9b073427d7..ca04b7bb5a 100644
--- a/crates/ide/src/goto_type_definition.rs
+++ b/crates/ide/src/goto_type_definition.rs
@@ -24,11 +24,9 @@ pub(crate) fn goto_type_definition(
     let file: ast::SourceFile = sema.parse_guess_edition(file_id);
     let token: SyntaxToken =
         pick_best_token(file.syntax().token_at_offset(offset), |kind| match kind {
-            IDENT | INT_NUMBER | T![self] => 3,
-            // operators
-            T!['('] | T!['['] | T!['{'] | T![')'] | T![']'] | T!['}'] | T![!] | T![?] => 2,
-            kind if !kind.is_trivia() => 1,
-            _ => 0,
+            IDENT | INT_NUMBER | T![self] => 2,
+            kind if kind.is_trivia() => 0,
+            _ => 1,
         })?;
 
     let mut res = Vec::new();
diff --git a/crates/ide/src/status.rs b/crates/ide/src/status.rs
index ce21e3cad5..67d6932da9 100644
--- a/crates/ide/src/status.rs
+++ b/crates/ide/src/status.rs
@@ -69,7 +69,6 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
                 dependencies,
                 origin,
                 is_proc_macro,
-                ..
             } = &crate_graph[crate_id];
             format_to!(
                 buf,
diff --git a/crates/intern/src/symbol/symbols.rs b/crates/intern/src/symbol/symbols.rs
index 5d05ef3b79..2feca32ff8 100644
--- a/crates/intern/src/symbol/symbols.rs
+++ b/crates/intern/src/symbol/symbols.rs
@@ -177,7 +177,6 @@ define_symbols! {
     coroutine_state,
     coroutine,
     count,
-    crate_name,
     crate_type,
     CStr,
     debug_assertions,
diff --git a/crates/project-model/src/project_json.rs b/crates/project-model/src/project_json.rs
index a09c7a77ab..7dea0c3839 100644
--- a/crates/project-model/src/project_json.rs
+++ b/crates/project-model/src/project_json.rs
@@ -52,7 +52,7 @@
 use base_db::{CrateDisplayName, CrateName};
 use cfg::CfgAtom;
 use paths::{AbsPath, AbsPathBuf, Utf8PathBuf};
-use rustc_hash::{FxHashMap, FxHashSet};
+use rustc_hash::FxHashMap;
 use serde::{de, Deserialize, Serialize};
 use span::Edition;
 
@@ -122,25 +122,6 @@ impl ProjectJson {
                         None => None,
                     };
 
-                    let cfg = crate_data
-                        .cfg_groups
-                        .iter()
-                        .flat_map(|cfg_extend| {
-                            let cfg_group = data.cfg_groups.get(cfg_extend);
-                            match cfg_group {
-                                Some(cfg_group) => cfg_group.0.iter().cloned(),
-                                None => {
-                                    tracing::error!(
-                                        "Unknown cfg group `{cfg_extend}` in crate `{}`",
-                                        crate_data.display_name.as_deref().unwrap_or("<unknown>"),
-                                    );
-                                    [].iter().cloned()
-                                }
-                            }
-                        })
-                        .chain(crate_data.cfg.0)
-                        .collect();
-
                     Crate {
                         display_name: crate_data
                             .display_name
@@ -150,7 +131,7 @@ impl ProjectJson {
                         edition: crate_data.edition.into(),
                         version: crate_data.version.as_ref().map(ToString::to_string),
                         deps: crate_data.deps,
-                        cfg,
+                        cfg: crate_data.cfg,
                         target: crate_data.target,
                         env: crate_data.env,
                         proc_macro_dylib_path: crate_data
@@ -325,17 +306,11 @@ pub enum RunnableKind {
 pub struct ProjectJsonData {
     sysroot: Option<Utf8PathBuf>,
     sysroot_src: Option<Utf8PathBuf>,
-    #[serde(default)]
-    cfg_groups: FxHashMap<String, CfgList>,
     crates: Vec<CrateData>,
     #[serde(default)]
     runnables: Vec<RunnableData>,
 }
 
-#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Default)]
-#[serde(transparent)]
-struct CfgList(#[serde(with = "cfg_")] Vec<CfgAtom>);
-
 #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
 struct CrateData {
     display_name: Option<String>,
@@ -345,9 +320,8 @@ struct CrateData {
     version: Option<semver::Version>,
     deps: Vec<Dep>,
     #[serde(default)]
-    cfg_groups: FxHashSet<String>,
-    #[serde(default)]
-    cfg: CfgList,
+    #[serde(with = "cfg_")]
+    cfg: Vec<CfgAtom>,
     target: Option<String>,
     #[serde(default)]
     env: FxHashMap<String, String>,
diff --git a/crates/rust-analyzer/src/cli/lsif.rs b/crates/rust-analyzer/src/cli/lsif.rs
index f2d21208d5..89fe712ced 100644
--- a/crates/rust-analyzer/src/cli/lsif.rs
+++ b/crates/rust-analyzer/src/cli/lsif.rs
@@ -22,7 +22,7 @@ use crate::{
 };
 
 struct LsifManager<'a> {
-    id_counter: i32,
+    count: i32,
     token_map: FxHashMap<TokenId, Id>,
     range_map: FxHashMap<FileRange, Id>,
     file_map: FxHashMap<FileId, Id>,
@@ -44,7 +44,7 @@ impl From<Id> for lsp_types::NumberOrString {
 impl LsifManager<'_> {
     fn new<'a>(analysis: &'a Analysis, db: &'a RootDatabase, vfs: &'a Vfs) -> LsifManager<'a> {
         LsifManager {
-            id_counter: 0,
+            count: 0,
             token_map: FxHashMap::default(),
             range_map: FxHashMap::default(),
             file_map: FxHashMap::default(),
@@ -56,9 +56,9 @@ impl LsifManager<'_> {
     }
 
     fn add(&mut self, data: lsif::Element) -> Id {
-        let id = Id(self.id_counter);
+        let id = Id(self.count);
         self.emit(&serde_json::to_string(&lsif::Entry { id: id.into(), data }).unwrap());
-        self.id_counter += 1;
+        self.count += 1;
         id
     }
 
diff --git a/crates/rust-analyzer/src/cli/scip.rs b/crates/rust-analyzer/src/cli/scip.rs
index f8d2608a31..a8a02712fe 100644
--- a/crates/rust-analyzer/src/cli/scip.rs
+++ b/crates/rust-analyzer/src/cli/scip.rs
@@ -48,6 +48,7 @@ impl flags::Scip {
             let error_sink;
             (config, error_sink, _) = config.apply_change(change);
 
+            // FIXME @alibektas : What happens to errors without logging?
             error!(?error_sink, "Config Error(s)");
         }
         let cargo_config = config.cargo();
@@ -114,6 +115,7 @@ impl flags::Scip {
 
             tokens.into_iter().for_each(|(text_range, id)| {
                 let token = si.tokens.get(id).unwrap();
+
                 let range = text_range_to_scip_range(&line_index, text_range);
                 let symbol = tokens_to_symbol
                     .entry(id)
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 9d0082c370..700ae749dc 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -696,7 +696,6 @@ impl GlobalStateSnapshot {
                     };
 
                     return Some(TargetSpec::ProjectJson(ProjectJsonTargetSpec {
-                        crate_id,
                         label: build.label,
                         target_kind: build.target_kind,
                         shell_runnables: project.runnables().to_owned(),
diff --git a/crates/rust-analyzer/src/handlers/notification.rs b/crates/rust-analyzer/src/handlers/notification.rs
index 38b88ff2d0..87b024c311 100644
--- a/crates/rust-analyzer/src/handlers/notification.rs
+++ b/crates/rust-analyzer/src/handlers/notification.rs
@@ -10,7 +10,6 @@ use lsp_types::{
     DidOpenTextDocumentParams, DidSaveTextDocumentParams, WorkDoneProgressCancelParams,
 };
 use paths::Utf8PathBuf;
-use stdx::TupleExt;
 use triomphe::Arc;
 use vfs::{AbsPathBuf, ChangeKind, VfsPath};
 
@@ -291,11 +290,11 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
         let mut updated = false;
         let task = move || -> std::result::Result<(), ide::Cancelled> {
             // Is the target binary? If so we let flycheck run only for the workspace that contains the crate.
-            let target = TargetSpec::for_file(&world, file_id)?.and_then(|it| {
-                let tgt_kind = it.target_kind();
-                let (tgt_name, crate_id) = match it {
-                    TargetSpec::Cargo(c) => (c.target, c.crate_id),
-                    TargetSpec::ProjectJson(p) => (p.label, p.crate_id),
+            let target = TargetSpec::for_file(&world, file_id)?.and_then(|x| {
+                let tgt_kind = x.target_kind();
+                let tgt_name = match x {
+                    TargetSpec::Cargo(c) => c.target,
+                    TargetSpec::ProjectJson(p) => p.label,
                 };
 
                 let tgt = match tgt_kind {
@@ -306,25 +305,25 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
                     _ => return None,
                 };
 
-                Some((tgt, crate_id))
+                Some(tgt)
             });
 
-            let crate_ids = match target {
-                // Trigger flychecks for the only crate which the target belongs to
-                Some((_, krate)) => vec![krate],
-                None => {
-                    // Trigger flychecks for all workspaces that depend on the saved file
-                    // Crates containing or depending on the saved file
-                    world
-                        .analysis
-                        .crates_for(file_id)?
-                        .into_iter()
-                        .flat_map(|id| world.analysis.transitive_rev_deps(id))
-                        .flatten()
-                        .unique()
-                        .collect::<Vec<_>>()
-                }
+            let crate_ids = if target.is_some() {
+                // Trigger flychecks for the only workspace which the binary crate belongs to
+                world.analysis.crates_for(file_id)?.into_iter().unique().collect::<Vec<_>>()
+            } else {
+                // Trigger flychecks for all workspaces that depend on the saved file
+                // Crates containing or depending on the saved file
+                world
+                    .analysis
+                    .crates_for(file_id)?
+                    .into_iter()
+                    .flat_map(|id| world.analysis.transitive_rev_deps(id))
+                    .flatten()
+                    .unique()
+                    .collect::<Vec<_>>()
             };
+
             let crate_root_paths: Vec<_> = crate_ids
                 .iter()
                 .filter_map(|&crate_id| {
@@ -376,8 +375,7 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
                         match package
                             .filter(|_| !world.config.flycheck_workspace() || target.is_some())
                         {
-                            Some(package) => flycheck
-                                .restart_for_package(package, target.clone().map(TupleExt::head)),
+                            Some(package) => flycheck.restart_for_package(package, target.clone()),
                             None => flycheck.restart_workspace(saved_file.clone()),
                         }
                         continue;
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 68366136ed..2a91d614e5 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -565,23 +565,6 @@ impl GlobalState {
                         .collect()
                 };
 
-            // Also explicitly watch any build files configured in JSON project files.
-            for ws in self.workspaces.iter() {
-                if let ProjectWorkspaceKind::Json(project_json) = &ws.kind {
-                    for (_, krate) in project_json.crates() {
-                        let Some(build) = &krate.build else {
-                            continue;
-                        };
-                        watchers.push(lsp_types::FileSystemWatcher {
-                            glob_pattern: lsp_types::GlobPattern::String(
-                                build.build_file.to_string(),
-                            ),
-                            kind: None,
-                        });
-                    }
-                }
-            }
-
             watchers.extend(
                 iter::once(Config::user_config_path())
                     .chain(self.workspaces.iter().map(|ws| ws.manifest().map(ManifestPath::as_ref)))
diff --git a/crates/rust-analyzer/src/target_spec.rs b/crates/rust-analyzer/src/target_spec.rs
index 954e13cbf2..965fd415e9 100644
--- a/crates/rust-analyzer/src/target_spec.rs
+++ b/crates/rust-analyzer/src/target_spec.rs
@@ -62,7 +62,6 @@ pub(crate) struct CargoTargetSpec {
 
 #[derive(Clone, Debug)]
 pub(crate) struct ProjectJsonTargetSpec {
-    pub(crate) crate_id: CrateId,
     pub(crate) label: String,
     pub(crate) target_kind: TargetKind,
     pub(crate) shell_runnables: Vec<Runnable>,
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc
index 246ebdab2c..703ec66921 100644
--- a/docs/user/manual.adoc
+++ b/docs/user/manual.adoc
@@ -705,12 +705,6 @@ interface JsonProject {
     /// several different "sysroots" in one graph of
     /// crates.
     sysroot_src?: string;
-    /// List of groups of common cfg values, to allow
-    /// sharing them between crates.
-    ///
-    /// Maps from group name to its cfgs. Cfg follow
-    /// the same format as `Crate.cfg`.
-    cfg_groups?: { [key: string]: string[]; };
     /// The set of crates comprising the current
     /// project. Must include all transitive
     /// dependencies as well as sysroot crate (libstd,
@@ -760,12 +754,6 @@ interface Crate {
         include_dirs: string[],
         exclude_dirs: string[],
     },
-    /// List of cfg groups this crate inherits.
-    ///
-    /// All cfg in these groups will be concatenated to
-    /// `cfg`. It is impossible to replace a value from
-    /// the groups.
-    cfg_groups?: string[];
     /// The set of cfgs activated for a given crate, like
     /// `["unix", "feature=\"foo\"", "feature=\"bar\""]`.
     cfg: string[];


Test patch:
diff --git a/crates/hir-def/src/macro_expansion_tests/mod.rs b/crates/hir-def/src/macro_expansion_tests/mod.rs
index 0d232deb2c..7f76119251 100644
--- a/crates/hir-def/src/macro_expansion_tests/mod.rs
+++ b/crates/hir-def/src/macro_expansion_tests/mod.rs
@@ -95,16 +95,11 @@ pub fn identity_when_valid(_attr: TokenStream, item: TokenStream) -> TokenStream
     for macro_call in source_file.syntax().descendants().filter_map(ast::MacroCall::cast) {
         let macro_call = InFile::new(source.file_id, &macro_call);
         let res = macro_call
-            .as_call_id(
-                &db,
-                resolver.module(),
-                |path| {
-                    resolver
-                        .resolve_path_as_macro(&db, path, Some(MacroSubNs::Bang))
-                        .map(|(it, _)| db.macro_def(it))
-                },
-                |module| def_map.path_for_module(&db, module),
-            )
+            .as_call_id_with_errors(&db, krate, |path| {
+                resolver
+                    .resolve_path_as_macro(&db, path, Some(MacroSubNs::Bang))
+                    .map(|(it, _)| db.macro_def(it))
+            })
             .unwrap();
         let macro_call_id = res.value.unwrap();
         let macro_file = MacroFileId { macro_call_id };
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index fc59307806..8b60e562d7 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -8702,68 +8702,3 @@ fn foo() {
         "#]],
     );
 }
-
-#[test]
-fn module_path_macro() {
-    check(
-        r##"
-//- minicore: module_path
-
-const C$0: &'static str = module_path!();
-"##,
-        expect![[r#"
-            *C*
-
-            ```rust
-            test
-            ```
-
-            ```rust
-            const C: &'static str = "test"
-            ```
-        "#]],
-    );
-    check(
-        r##"
-//- minicore: module_path
-
-mod foo {
-    const C$0: &'static str = module_path!();
-}
-"##,
-        expect![[r#"
-            *C*
-
-            ```rust
-            test::foo
-            ```
-
-            ```rust
-            const C: &'static str = "test::foo"
-            ```
-        "#]],
-    );
-    check(
-        r##"
-//- minicore: module_path
-mod baz {
-    const _: () = {
-        mod bar {
-            const C$0: &'static str = module_path!();
-        }
-    }
-}
-"##,
-        expect![[r#"
-            *C*
-
-            ```rust
-            test::bar
-            ```
-
-            ```rust
-            const C: &'static str = "test::baz::bar"
-            ```
-        "#]],
-    );
-}
diff --git a/crates/project-model/src/tests.rs b/crates/project-model/src/tests.rs
index f540bb94c1..11bdc18eef 100644
--- a/crates/project-model/src/tests.rs
+++ b/crates/project-model/src/tests.rs
@@ -235,12 +235,6 @@ fn rust_project_hello_world_project_model() {
     );
 }
 
-#[test]
-fn rust_project_cfg_groups() {
-    let (crate_graph, _proc_macros) = load_rust_project("cfg-groups.json");
-    check_crate_graph(crate_graph, expect_file!["../test_data/output/rust_project_cfg_groups.txt"]);
-}
-
 #[test]
 fn rust_project_is_proc_macro_has_proc_macro_dep() {
     let (crate_graph, _proc_macros) = load_rust_project("is-proc-macro-project.json");
diff --git a/crates/project-model/test_data/cfg-groups.json b/crates/project-model/test_data/cfg-groups.json
deleted file mode 100644
index 29f83afd9d..0000000000
--- a/crates/project-model/test_data/cfg-groups.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-    "sysroot_src": null,
-    "cfg_groups": {
-        "group1": ["group1_cfg=\"some_config\"", "group1_other_cfg=\"other_config\""],
-        "group2": ["group2_cfg=\"yet_another_config\""]
-    },
-    "crates": [
-        {
-            "display_name": "hello_world",
-            "root_module": "$ROOT$src/lib.rs",
-            "edition": "2018",
-            "cfg_groups": ["group1", "group2"],
-            "deps": [],
-            "is_workspace_member": true
-        },
-        {
-            "display_name": "other_crate",
-            "root_module": "$ROOT$src/lib.rs",
-            "edition": "2018",
-            "cfg_groups": ["group2"],
-            "cfg": ["group2_cfg=\"fourth_config\"", "unrelated_cfg"],
-            "deps": [],
-            "is_workspace_member": true
-        }
-    ]
-}
diff --git a/crates/project-model/test_data/output/rust_project_cfg_groups.txt b/crates/project-model/test_data/output/rust_project_cfg_groups.txt
deleted file mode 100644
index 8261e5a2d9..0000000000
--- a/crates/project-model/test_data/output/rust_project_cfg_groups.txt
+++ /dev/null
@@ -1,545 +0,0 @@
-{
-    0: CrateData {
-        root_file_id: FileId(
-            1,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "alloc",
-                ),
-                canonical_name: "alloc",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [
-            Dependency {
-                crate_id: Idx::<CrateData>(1),
-                name: CrateName(
-                    "core",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-        ],
-        origin: Lang(
-            Alloc,
-        ),
-        is_proc_macro: false,
-    },
-    1: CrateData {
-        root_file_id: FileId(
-            2,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "core",
-                ),
-                canonical_name: "core",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [],
-        origin: Lang(
-            Core,
-        ),
-        is_proc_macro: false,
-    },
-    2: CrateData {
-        root_file_id: FileId(
-            3,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "panic_abort",
-                ),
-                canonical_name: "panic_abort",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [],
-        origin: Lang(
-            Other,
-        ),
-        is_proc_macro: false,
-    },
-    3: CrateData {
-        root_file_id: FileId(
-            4,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "panic_unwind",
-                ),
-                canonical_name: "panic_unwind",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [],
-        origin: Lang(
-            Other,
-        ),
-        is_proc_macro: false,
-    },
-    4: CrateData {
-        root_file_id: FileId(
-            5,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "proc_macro",
-                ),
-                canonical_name: "proc_macro",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [
-            Dependency {
-                crate_id: Idx::<CrateData>(6),
-                name: CrateName(
-                    "std",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(1),
-                name: CrateName(
-                    "core",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-        ],
-        origin: Lang(
-            ProcMacro,
-        ),
-        is_proc_macro: false,
-    },
-    5: CrateData {
-        root_file_id: FileId(
-            6,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "profiler_builtins",
-                ),
-                canonical_name: "profiler_builtins",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [],
-        origin: Lang(
-            Other,
-        ),
-        is_proc_macro: false,
-    },
-    6: CrateData {
-        root_file_id: FileId(
-            7,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "std",
-                ),
-                canonical_name: "std",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [
-            Dependency {
-                crate_id: Idx::<CrateData>(0),
-                name: CrateName(
-                    "alloc",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(3),
-                name: CrateName(
-                    "panic_unwind",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(2),
-                name: CrateName(
-                    "panic_abort",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(1),
-                name: CrateName(
-                    "core",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(5),
-                name: CrateName(
-                    "profiler_builtins",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(9),
-                name: CrateName(
-                    "unwind",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(7),
-                name: CrateName(
-                    "std_detect",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(8),
-                name: CrateName(
-                    "test",
-                ),
-                prelude: true,
-                sysroot: false,
-            },
-        ],
-        origin: Lang(
-            Std,
-        ),
-        is_proc_macro: false,
-    },
-    7: CrateData {
-        root_file_id: FileId(
-            8,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "std_detect",
-                ),
-                canonical_name: "std_detect",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [],
-        origin: Lang(
-            Other,
-        ),
-        is_proc_macro: false,
-    },
-    8: CrateData {
-        root_file_id: FileId(
-            9,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "test",
-                ),
-                canonical_name: "test",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [],
-        origin: Lang(
-            Test,
-        ),
-        is_proc_macro: false,
-    },
-    9: CrateData {
-        root_file_id: FileId(
-            10,
-        ),
-        edition: Edition2021,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "unwind",
-                ),
-                canonical_name: "unwind",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "debug_assertions",
-                "miri",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [],
-        origin: Lang(
-            Other,
-        ),
-        is_proc_macro: false,
-    },
-    10: CrateData {
-        root_file_id: FileId(
-            11,
-        ),
-        edition: Edition2018,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "hello_world",
-                ),
-                canonical_name: "hello_world",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "group1_cfg=some_config",
-                "group1_other_cfg=other_config",
-                "group2_cfg=yet_another_config",
-                "rust_analyzer",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [
-            Dependency {
-                crate_id: Idx::<CrateData>(1),
-                name: CrateName(
-                    "core",
-                ),
-                prelude: true,
-                sysroot: true,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(0),
-                name: CrateName(
-                    "alloc",
-                ),
-                prelude: false,
-                sysroot: true,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(6),
-                name: CrateName(
-                    "std",
-                ),
-                prelude: true,
-                sysroot: true,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(8),
-                name: CrateName(
-                    "test",
-                ),
-                prelude: false,
-                sysroot: true,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(4),
-                name: CrateName(
-                    "proc_macro",
-                ),
-                prelude: false,
-                sysroot: true,
-            },
-        ],
-        origin: Local {
-            repo: None,
-            name: Some(
-                "hello_world",
-            ),
-        },
-        is_proc_macro: false,
-    },
-    11: CrateData {
-        root_file_id: FileId(
-            12,
-        ),
-        edition: Edition2018,
-        version: None,
-        display_name: Some(
-            CrateDisplayName {
-                crate_name: CrateName(
-                    "other_crate",
-                ),
-                canonical_name: "other_crate",
-            },
-        ),
-        cfg_options: CfgOptions(
-            [
-                "group2_cfg=fourth_config",
-                "group2_cfg=yet_another_config",
-                "rust_analyzer",
-                "unrelated_cfg",
-            ],
-        ),
-        potential_cfg_options: None,
-        env: Env {
-            entries: {},
-        },
-        dependencies: [
-            Dependency {
-                crate_id: Idx::<CrateData>(1),
-                name: CrateName(
-                    "core",
-                ),
-                prelude: true,
-                sysroot: true,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(0),
-                name: CrateName(
-                    "alloc",
-                ),
-                prelude: false,
-                sysroot: true,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(6),
-                name: CrateName(
-                    "std",
-                ),
-                prelude: true,
-                sysroot: true,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(8),
-                name: CrateName(
-                    "test",
-                ),
-                prelude: false,
-                sysroot: true,
-            },
-            Dependency {
-                crate_id: Idx::<CrateData>(4),
-                name: CrateName(
-                    "proc_macro",
-                ),
-                prelude: false,
-                sysroot: true,
-            },
-        ],
-        origin: Local {
-            repo: None,
-            name: Some(
-                "other_crate",
-            ),
-        },
-        is_proc_macro: false,
-    },
-}
\ No newline at end of file
diff --git a/crates/test-utils/src/minicore.rs b/crates/test-utils/src/minicore.rs
index 2e01d19908..2d615c34a3 100644
--- a/crates/test-utils/src/minicore.rs
+++ b/crates/test-utils/src/minicore.rs
@@ -41,7 +41,6 @@
 //!     iterator: option
 //!     iterators: iterator, fn
 //!     manually_drop: drop
-//!     module_path:
 //!     non_null:
 //!     non_zero:
 //!     option: panic
@@ -1435,16 +1434,6 @@ mod panicking {
 
 #[macro_use]
 mod macros {
-    // region:module_path
-    #[macro_export]
-    #[rustc_builtin_macro]
-    macro_rules! module_path {
-        ($($arg:tt)*) => {
-            /* compiler built-in */
-        };
-    }
-    // endregion:module_path
-
     // region:panic
     #[macro_export]
     #[rustc_builtin_macro(core_panic)]