Skip to content

Commit

Permalink
Bug 1738133 - Undo workaround for rust-lang/rust#88576. r=firefox-bui…
Browse files Browse the repository at this point in the history
…ld-system-reviewers,nalexander

Differential Revision: https://phabricator.services.mozilla.com/D133015
  • Loading branch information
glandium committed Dec 7, 2021
1 parent aaa57dd commit ff6f9d7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,3 @@ path = "third_party/rust/mio-0.6.23"

[patch.crates-io.prost-derive]
path = "third_party/rust/prost-derive"

# Patched to work around https://github.com/rust-lang/rust/issues/88576
[patch.crates-io.winapi-util]
path = "third_party/rust/winapi-util"
17 changes: 15 additions & 2 deletions build/moz.configure/rust.configure
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ def cargo_info(cargo):
)


@depends(rustc_info, cargo_info)
@depends(rustc_info, cargo_info, target)
@imports(_from="mozboot.util", _import="MINIMUM_RUST_VERSION")
@imports(_from="textwrap", _import="dedent")
def rust_compiler(rustc_info, cargo_info):
def rust_compiler(rustc_info, cargo_info, target):
if not rustc_info:
die(
dedent(
Expand Down Expand Up @@ -203,6 +203,19 @@ def rust_compiler(rustc_info, cargo_info):
)
)

if target.kernel == "WINNT" and (version.major, version.minor) == (1, 56):
die(
dedent(
"""\
Rust compiler 1.56.* is not supported for Windows builds.
Use a newer or an older version.
See https://github.com/rust-lang/rust/issues/88576.
"""
)
)

if not cargo_info:
die(
dedent(
Expand Down
13 changes: 3 additions & 10 deletions third_party/rust/winapi-util/src/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,13 @@ struct HandleRefInner(Option<File>);

impl Drop for HandleRefInner {
fn drop(&mut self) {
self.0.take().map(|f| f.into_raw_handle());
self.0.take().unwrap().into_raw_handle();
}
}

impl AsRawHandle for HandleRef {
fn as_raw_handle(&self) -> RawHandle {
match (self.0).0.as_ref() {
Some(f) => f.as_raw_handle(),
None => std::ptr::null_mut(),
}
self.as_file().as_raw_handle()
}
}

Expand Down Expand Up @@ -162,11 +159,7 @@ impl HandleRef {
/// is a valid handle. The caller must ensure this is true before invoking
/// this constructor.
pub unsafe fn from_raw_handle(handle: RawHandle) -> HandleRef {
HandleRef(HandleRefInner(if handle.is_null() {
None
} else {
Some(File::from_raw_handle(handle))
}))
HandleRef(HandleRefInner(Some(File::from_raw_handle(handle))))
}

/// Return this handle as a standard `File` reference.
Expand Down

0 comments on commit ff6f9d7

Please sign in to comment.