]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/compiletest/src/runtest.rs
Add a test case for incremental + codegen-units interaction.
[rust.git] / src / tools / compiletest / src / runtest.rs
index 0ee016f33dd885bae545c50f7653e193c8568f20..295d96ce419760bf5a0d7b2eb281329a6a0a3dd9 100644 (file)
@@ -2517,7 +2517,7 @@ fn str_to_mono_item(s: &str, cgu_has_crate_disambiguator: bool) -> MonoItem {
                     .filter(|s| !s.is_empty())
                     .map(|s| {
                         if cgu_has_crate_disambiguator {
-                            remove_crate_disambiguator_from_cgu(s)
+                            remove_crate_disambiguators_from_set_of_cgu_names(s)
                         } else {
                             s.to_string()
                         }
@@ -2567,6 +2567,16 @@ fn remove_crate_disambiguator_from_cgu(cgu: &str) -> String {
 
             new_name
         }
+
+        // The name of merged CGUs is constructed as the names of the original
+        // CGUs joined with "--". This function splits such composite CGU names
+        // and handles each component individually.
+        fn remove_crate_disambiguators_from_set_of_cgu_names(cgus: &str) -> String {
+            cgus.split("--")
+                .map(|cgu| remove_crate_disambiguator_from_cgu(cgu))
+                .collect::<Vec<_>>()
+                .join("--")
+        }
     }
 
     fn init_incremental_test(&self) {