From 5c0c09c9c32231843b22a17a467c4170530bd220 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 31 Mar 2021 13:24:08 +0300 Subject: [PATCH] internal: document semantics for missing names --- crates/hir_expand/src/name.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/hir_expand/src/name.rs b/crates/hir_expand/src/name.rs index cd691b1d2c..203ebbe85c 100644 --- a/crates/hir_expand/src/name.rs +++ b/crates/hir_expand/src/name.rs @@ -55,6 +55,15 @@ impl Name { } } + /// A fake name for things missing in the source code. + /// + /// For example, `impl Foo for {}` should be treated as a trait impl for a + /// type with a missing name. Similarly, `struct S { : u32 }` should have a + /// single field with a missing name. + /// + /// Ideally, we want a `gensym` semantics for missing names -- each missing + /// name is equal only to itself. It's not clear how to implement this in + /// salsa though, so we punt on that bit for a moment. pub fn missing() -> Name { Name::new_text("[missing name]".into()) }