Move path2cstr to rustc_fs_util

This commit is contained in:
Mark Rousskov 2018-08-03 15:37:15 -06:00
parent e3177c6f3f
commit dea13b4bc7
5 changed files with 17 additions and 20 deletions

View file

@ -30,8 +30,7 @@ use CrateInfo;
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc::ty::TyCtxt;
use rustc::util::common::{time_ext, time_depth, set_time_depth, print_time_passes_entry};
use rustc::util::common::path2cstr;
use rustc_fs_util::link_or_copy;
use rustc_fs_util::{path2cstr, link_or_copy};
use errors::{self, Handler, Level, DiagnosticBuilder, FatalError, DiagnosticId};
use errors::emitter::{Emitter};
use syntax::attr;

View file

@ -35,7 +35,7 @@ use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt};
use rustc::ty::layout::{self, Align, LayoutOf, PrimitiveExt, Size, TyLayout};
use rustc::session::config;
use rustc::util::nodemap::FxHashMap;
use rustc::util::common::path2cstr;
use rustc_fs_util::path2cstr;
use libc::{c_uint, c_longlong};
use std::ffi::CString;

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use rustc::util::common;
use rustc::middle::cstore::MetadataLoader;
use rustc_target::spec::Target;
use llvm;
@ -19,6 +18,7 @@ use rustc_data_structures::owning_ref::OwningRef;
use std::path::Path;
use std::ptr;
use std::slice;
use rustc_fs_util::path2cstr;
pub use rustc_data_structures::sync::MetadataRef;
@ -57,7 +57,7 @@ impl MetadataLoader for LlvmMetadataLoader {
filename: &Path)
-> Result<MetadataRef, String> {
unsafe {
let buf = common::path2cstr(filename);
let buf = path2cstr(filename);
let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf.as_ptr())
.ok_or_else(|| format!("error reading library: '{}'", filename.display()))?;
let of = ObjectFile::new(mb)