]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/metadata/loader.rs
rollup merge of #17355 : gamazeps/issue17210
[rust.git] / src / librustc / metadata / loader.rs
index d2e1fca0da75d3cc7c4bec3fc28d05ea21789ab7..f63705bfb9901dd792e47dea25929c877dfacce0 100644 (file)
 
 use std::c_str::ToCStr;
 use std::cmp;
+use std::io::fs::PathExtensions;
 use std::io;
 use std::mem;
 use std::ptr;
@@ -448,7 +449,7 @@ fn find_library_crate(&mut self) -> Option<Library> {
         // libraries corresponds to the crate id and hash criteria that this
         // search is being performed for.
         let mut libraries = Vec::new();
-        for (_hash, (rlibs, dylibs)) in candidates.move_iter() {
+        for (_hash, (rlibs, dylibs)) in candidates.into_iter() {
             let mut metadata = None;
             let rlib = self.extract_one(rlibs, "rlib", &mut metadata);
             let dylib = self.extract_one(dylibs, "dylib", &mut metadata);
@@ -469,7 +470,7 @@ fn find_library_crate(&mut self) -> Option<Library> {
         // libraries or not.
         match libraries.len() {
             0 => None,
-            1 => Some(libraries.move_iter().next().unwrap()),
+            1 => Some(libraries.into_iter().next().unwrap()),
             _ => {
                 self.sess.span_err(self.span,
                     format!("multiple matching crates for `{}`",
@@ -520,11 +521,11 @@ fn extract_one(&mut self, m: HashSet<Path>, flavor: &str,
             if m.len() == 0 {
                 return None
             } else if m.len() == 1 {
-                return Some(m.move_iter().next().unwrap())
+                return Some(m.into_iter().next().unwrap())
             }
         }
 
-        for lib in m.move_iter() {
+        for lib in m.into_iter() {
             info!("{} reading metadata from: {}", flavor, lib.display());
             let metadata = match get_metadata_section(self.os, &lib) {
                 Ok(blob) => {
@@ -615,7 +616,7 @@ fn crate_matches(&mut self, crate_data: &[u8], libpath: &Path) -> bool {
     // dynamic libraries
     fn dylibname(&self) -> Option<(&'static str, &'static str)> {
         match self.os {
-            abi::OsWin32 => Some((WIN32_DLL_PREFIX, WIN32_DLL_SUFFIX)),
+            abi::OsWindows => Some((WIN32_DLL_PREFIX, WIN32_DLL_SUFFIX)),
             abi::OsMacos => Some((MACOS_DLL_PREFIX, MACOS_DLL_SUFFIX)),
             abi::OsLinux => Some((LINUX_DLL_PREFIX, LINUX_DLL_SUFFIX)),
             abi::OsAndroid => Some((ANDROID_DLL_PREFIX, ANDROID_DLL_SUFFIX)),
@@ -666,9 +667,9 @@ fn find_commandline_library(&mut self) -> Option<Library> {
         let mut dylibs = HashSet::new();
         for loc in locs {
             if loc.filename_str().unwrap().ends_with(".rlib") {
-                rlibs.insert(loc.clone());
+                rlibs.insert(fs::realpath(&loc).unwrap());
             } else {
-                dylibs.insert(loc.clone());
+                dylibs.insert(fs::realpath(&loc).unwrap());
             }
         }
 
@@ -824,7 +825,7 @@ pub fn meta_section_name(os: abi::Os) -> Option<&'static str> {
     match os {
         abi::OsMacos => Some("__DATA,__note.rustc"),
         abi::OsiOS => Some("__DATA,__note.rustc"),
-        abi::OsWin32 => Some(".note.rustc"),
+        abi::OsWindows => Some(".note.rustc"),
         abi::OsLinux => Some(".note.rustc"),
         abi::OsAndroid => Some(".note.rustc"),
         abi::OsFreebsd => Some(".note.rustc"),
@@ -836,7 +837,7 @@ pub fn read_meta_section_name(os: abi::Os) -> &'static str {
     match os {
         abi::OsMacos => "__note.rustc",
         abi::OsiOS => unreachable!(),
-        abi::OsWin32 => ".note.rustc",
+        abi::OsWindows => ".note.rustc",
         abi::OsLinux => ".note.rustc",
         abi::OsAndroid => ".note.rustc",
         abi::OsFreebsd => ".note.rustc",