]> git.lizzy.rs Git - rust.git/blobdiff - crates/base_db/src/input.rs
Merge #6124
[rust.git] / crates / base_db / src / input.rs
index 9a61f1d5660877d40c6215a4fda547f7b59c0be7..c330314d44235de6bb994b24392c8ca773a66321 100644 (file)
@@ -127,10 +127,11 @@ fn eq(&self, other: &ProcMacro) -> bool {
 pub struct CrateData {
     pub root_file_id: FileId,
     pub edition: Edition,
-    /// The name to display to the end user.
-    /// This actual crate name can be different in a particular dependent crate
-    /// or may even be missing for some cases, such as a dummy crate for the code snippet.
-    pub display_name: Option<String>,
+    /// A name used in the package's project declaration: for Cargo projects, it's [package].name,
+    /// can be different for other project types or even absent (a dummy crate for the code snippet, for example).
+    /// NOTE: The crate can be referenced as a dependency under a different name,
+    /// this one should be used when working with crate hierarchies.
+    pub declaration_name: Option<CrateName>,
     pub cfg_options: CfgOptions,
     pub env: Env,
     pub dependencies: Vec<Dependency>,
@@ -159,7 +160,7 @@ pub fn add_crate_root(
         &mut self,
         file_id: FileId,
         edition: Edition,
-        display_name: Option<String>,
+        declaration_name: Option<CrateName>,
         cfg_options: CfgOptions,
         env: Env,
         proc_macro: Vec<(SmolStr, Arc<dyn tt::TokenExpander>)>,
@@ -170,7 +171,7 @@ pub fn add_crate_root(
         let data = CrateData {
             root_file_id: file_id,
             edition,
-            display_name,
+            declaration_name,
             cfg_options,
             env,
             proc_macro,