Skip to content

Commit dd4b534

Browse files
committed
Regenrate docs and package.json
1 parent aecf26d commit dd4b534

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

crates/hir_def/src/db.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ pub trait InternDatabase: SourceDatabase {
5555
pub trait DefDatabase: InternDatabase + AstDatabase + Upcast<dyn AstDatabase> {
5656
#[salsa::input]
5757
fn enable_proc_attr_macros(&self) -> bool;
58-
#[salsa::input]
59-
fn enablse_proc_attr_macros(&self) -> bool;
6058

6159
#[salsa::invoke(ItemTree::file_item_tree_query)]
6260
fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>;

crates/rust-analyzer/src/config.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ config_data! {
301301
/// Internal config, path to proc-macro server executable (typically,
302302
/// this is rust-analyzer itself, but we override this in tests).
303303
procMacro_server: Option<PathBuf> = "null",
304+
/// Replaces the proc-macro expanders for the named proc-macros in the named crates with
305+
/// an identity expander that outputs the input again.
304306
procMacro_dummies: FxHashMap<Box<str>, Box<[Box<str>]>> = "{}",
305307

306308
/// Command to be executed instead of 'cargo' for runnables.
@@ -1167,7 +1169,13 @@ fn get_field<T: DeserializeOwned>(
11671169
.find_map(move |field| {
11681170
let mut pointer = field.replace('_', "/");
11691171
pointer.insert(0, '/');
1170-
json.pointer_mut(&pointer).and_then(|it| serde_json::from_value(it.take()).ok())
1172+
json.pointer_mut(&pointer).and_then(|it| match serde_json::from_value(it.take()) {
1173+
Ok(it) => Some(it),
1174+
Err(e) => {
1175+
tracing::warn!("Failed to deserialize config field at {}: {:?}", pointer, e);
1176+
None
1177+
}
1178+
})
11711179
})
11721180
.unwrap_or(default)
11731181
}
@@ -1228,6 +1236,9 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
12281236
"items": { "type": "string" },
12291237
"uniqueItems": true,
12301238
},
1239+
"FxHashMap<Box<str>, Box<[Box<str>]>>" => set! {
1240+
"type": "object",
1241+
},
12311242
"FxHashMap<String, SnippetDef>" => set! {
12321243
"type": "object",
12331244
},

crates/rust-analyzer/src/reload.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,6 @@ impl GlobalState {
291291
}
292292
},
293293
};
294-
self.analysis_host
295-
.raw_database_mut()
296-
.set_enable_proc_attr_macros(self.config.expand_proc_attr_macros());
297294
}
298295

299296
let watch = match files_config.watcher {
@@ -514,6 +511,8 @@ impl SourceRootConfig {
514511
}
515512
}
516513

514+
/// Load the proc-macros for the given lib path, replacing all expanders whose names are in `dummy_replace`
515+
/// with an identity dummy expander.
517516
pub(crate) fn load_proc_macro(
518517
client: Option<&ProcMacroServer>,
519518
path: &AbsPath,
@@ -586,6 +585,7 @@ pub(crate) fn load_proc_macro(
586585
}
587586
}
588587

588+
/// Dummy identity expander, used for proc-macros that are deliberately ignored by the user.
589589
#[derive(Debug)]
590590
struct DummyExpander;
591591

docs/user/generated_config.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,12 @@ Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScri
455455
Internal config, path to proc-macro server executable (typically,
456456
this is rust-analyzer itself, but we override this in tests).
457457
--
458+
[[rust-analyzer.procMacro.dummies]]rust-analyzer.procMacro.dummies (default: `{}`)::
459+
+
460+
--
461+
Replaces the proc-macro expanders for the named proc-macros in the named crates with
462+
an identity expander that outputs the input again.
463+
--
458464
[[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`)::
459465
+
460466
--

editors/code/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,11 @@
880880
"string"
881881
]
882882
},
883+
"rust-analyzer.procMacro.dummies": {
884+
"markdownDescription": "Replaces the proc-macro expanders for the named proc-macros in the named crates with\nan identity expander that outputs the input again.",
885+
"default": {},
886+
"type": "object"
887+
},
883888
"rust-analyzer.runnables.overrideCargo": {
884889
"markdownDescription": "Command to be executed instead of 'cargo' for runnables.",
885890
"default": null,

0 commit comments

Comments
 (0)