Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiling some rustc crates to wasm #54024

Merged
merged 1 commit into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions src/librustc_data_structures/flock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
//! librustdoc, it is not production quality at all.

#![allow(non_camel_case_types)]
use std::path::Path;
#![allow(nonstandard_style)]

pub use self::imp::Lock;
use std::io;
use std::path::Path;

#[cfg(unix)]
mod imp {
cfg_if! {
if #[cfg(unix)] {
use std::ffi::{CString, OsStr};
use std::os::unix::prelude::*;
use std::path::Path;
use std::io;
use libc;

#[cfg(any(target_os = "linux", target_os = "android"))]
Expand Down Expand Up @@ -236,16 +235,10 @@ mod imp {
}
}
}
}

#[cfg(windows)]
#[allow(nonstandard_style)]
mod imp {
use std::io;
} else if #[cfg(windows)] {
use std::mem;
use std::os::windows::prelude::*;
use std::os::windows::raw::HANDLE;
use std::path::Path;
use std::fs::{File, OpenOptions};
use std::os::raw::{c_ulong, c_int};

Expand Down Expand Up @@ -351,9 +344,22 @@ mod imp {

// Note that we don't need a Drop impl on the Windows: The file is unlocked
// automatically when it's closed.
} else {
#[derive(Debug)]
pub struct Lock(());

impl Lock {
pub fn new(_p: &Path, _wait: bool, _create: bool, _exclusive: bool)
-> io::Result<Lock>
{
let msg = "file locks not supported on this platform";
Err(io::Error::new(io::ErrorKind::Other, msg))
}
}
}
}

impl imp::Lock {
impl Lock {
pub fn panicking_new(p: &Path,
wait: bool,
create: bool,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
}
}

#[cfg(unix)]
#[cfg(not(windows))]
pub fn acquire_global_lock(_name: &str) -> Box<dyn Any> {
Box::new(())
}