about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-08-31 16:50:00 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-09-02 12:25:26 +0200
commitb3f850a50c47e832c4eacb006b1ff878678d2c4c (patch)
treeb1f2f5283c4ab5d2212e0b3380baefd222444ac5
parent3a8c4579160dd9a00c61f279c4d14ade02406ed3 (diff)
downloadrust-b3f850a50c47e832c4eacb006b1ff878678d2c4c.tar.gz
rust-b3f850a50c47e832c4eacb006b1ff878678d2c4c.zip
Remove root field from CrateLocator
-rw-r--r--compiler/rustc_metadata/src/creader.rs3
-rw-r--r--compiler/rustc_metadata/src/locator.rs10
2 files changed, 4 insertions, 9 deletions
diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs
index 0704c9a40e2..04d6aa0b469 100644
--- a/compiler/rustc_metadata/src/creader.rs
+++ b/compiler/rustc_metadata/src/creader.rs
@@ -555,7 +555,6 @@ impl<'a> CrateLoader<'a> {
                 extra_filename,
                 false, // is_host
                 path_kind,
-                root,
             );
 
             match self.load(&mut locator)? {
@@ -564,7 +563,7 @@ impl<'a> CrateLoader<'a> {
                     dep_kind = CrateDepKind::MacrosOnly;
                     match self.load_proc_macro(&mut locator, path_kind, host_hash)? {
                         Some(res) => res,
-                        None => return Err(locator.into_error()),
+                        None => return Err(locator.into_error(root.cloned())),
                     }
                 }
             }
diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs
index f0996f2fd28..11c306729f2 100644
--- a/compiler/rustc_metadata/src/locator.rs
+++ b/compiler/rustc_metadata/src/locator.rs
@@ -252,7 +252,6 @@ crate struct CrateLocator<'a> {
     pub target: &'a Target,
     pub triple: TargetTriple,
     pub filesearch: FileSearch<'a>,
-    root: Option<&'a CratePaths>,
     pub is_proc_macro: bool,
 
     // Mutable in-progress state or output.
@@ -301,7 +300,6 @@ impl<'a> CrateLocator<'a> {
         extra_filename: Option<&'a str>,
         is_host: bool,
         path_kind: PathKind,
-        root: Option<&'a CratePaths>,
     ) -> CrateLocator<'a> {
         // The all loop is because `--crate-type=rlib --crate-type=rlib` is
         // legal and produces both inside this type.
@@ -344,7 +342,6 @@ impl<'a> CrateLocator<'a> {
             } else {
                 sess.target_filesearch(path_kind)
             },
-            root,
             is_proc_macro: false,
             rejected_via_hash: Vec::new(),
             rejected_via_triple: Vec::new(),
@@ -709,10 +706,10 @@ impl<'a> CrateLocator<'a> {
         Ok(self.extract_lib(rlibs, rmetas, dylibs)?.map(|(_, lib)| lib))
     }
 
-    crate fn into_error(self) -> CrateError {
+    crate fn into_error(self, root: Option<CratePaths>) -> CrateError {
         CrateError::LocatorCombined(CombinedLocatorError {
             crate_name: self.crate_name,
-            root: self.root.cloned(),
+            root,
             triple: self.triple,
             dll_prefix: self.target.dll_prefix.clone(),
             dll_suffix: self.target.dll_suffix.clone(),
@@ -807,7 +804,6 @@ fn find_plugin_registrar_impl<'a>(
         None, // extra_filename
         true, // is_host
         PathKind::Crate,
-        None, // root
     );
 
     match locator.maybe_load_library_crate()? {
@@ -815,7 +811,7 @@ fn find_plugin_registrar_impl<'a>(
             Some(dylib) => Ok(dylib.0),
             None => Err(CrateError::NonDylibPlugin(name)),
         },
-        None => Err(locator.into_error()),
+        None => Err(locator.into_error(None)),
     }
 }