mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-17 06:26:55 +00:00
Auto merge of #137065 - jhpratt:rollup-ree9mej, r=jhpratt
Rollup of 9 pull requests Successful merges: - #135687 (re-export `FromCoroutine` from `core::iter`) - #135813 (CI: split i686-mingw job to three free runners) - #136749 (Implement Extend<AsciiChar> for String) - #136879 (Add safe new() to NotAllOnes) - #136978 (Windows: Update generated bindings) - #137028 (mir_build: Clarify some code for lowering `hir::PatExpr` to THIR) - #137029 (Remove unnecessary check code in unused_delims) - #137056 (made check_argument_compat public for use in miri) - #137062 (Forward all default methods for I/O impls) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
8c07d140e0
15
Cargo.lock
15
Cargo.lock
@ -6195,16 +6195,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "windows-bindgen"
|
||||
version = "0.58.0"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91cd28d93c692351f3a6e5615567c56756e330bee1c99c6bdd57bfc5ab15f589"
|
||||
checksum = "9b7fb600834d7e868f6e5bb748a86101427330fafbf9485c331b9d5f562d54a5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn 2.0.96",
|
||||
"windows-metadata",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -6285,12 +6280,6 @@ dependencies = [
|
||||
"syn 2.0.96",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-metadata"
|
||||
version = "0.58.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e837f3c3012cfe9e7086302a93f441a7999439be1ad4c530d55d2f6d2921809"
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.1.2"
|
||||
|
@ -241,7 +241,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||
interp_ok(caller == callee)
|
||||
}
|
||||
|
||||
fn check_argument_compat(
|
||||
/// Returns a `bool` saying whether the two arguments are ABI-compatible.
|
||||
pub fn check_argument_compat(
|
||||
&self,
|
||||
caller_abi: &ArgAbi<'tcx, Ty<'tcx>>,
|
||||
callee_abi: &ArgAbi<'tcx, Ty<'tcx>>,
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::util::{classify, parser};
|
||||
@ -781,29 +780,6 @@ trait UnusedDelimLint {
|
||||
right_pos: Option<BytePos>,
|
||||
is_kw: bool,
|
||||
) {
|
||||
// If `value` has `ExprKind::Err`, unused delim lint can be broken.
|
||||
// For example, the following code caused ICE.
|
||||
// This is because the `ExprKind::Call` in `value` has `ExprKind::Err` as its argument
|
||||
// and this leads to wrong spans. #104897
|
||||
//
|
||||
// ```
|
||||
// fn f(){(print!(á
|
||||
// ```
|
||||
use rustc_ast::visit::{Visitor, walk_expr};
|
||||
struct ErrExprVisitor;
|
||||
impl<'ast> Visitor<'ast> for ErrExprVisitor {
|
||||
type Result = ControlFlow<()>;
|
||||
fn visit_expr(&mut self, expr: &'ast ast::Expr) -> ControlFlow<()> {
|
||||
if let ExprKind::Err(_) = expr.kind {
|
||||
ControlFlow::Break(())
|
||||
} else {
|
||||
walk_expr(self, expr)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ErrExprVisitor.visit_expr(value).is_break() {
|
||||
return;
|
||||
}
|
||||
let spans = match value.kind {
|
||||
ast::ExprKind::Block(ref block, None) if let [stmt] = block.stmts.as_slice() => stmt
|
||||
.span
|
||||
|
@ -189,7 +189,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||
|
||||
// Lower the endpoint into a temporary `PatKind` that will then be
|
||||
// deconstructed to obtain the constant value and other data.
|
||||
let mut kind: PatKind<'tcx> = self.lower_lit(expr);
|
||||
let mut kind: PatKind<'tcx> = self.lower_pat_expr(expr);
|
||||
|
||||
// Unpeel any ascription or inline-const wrapper nodes.
|
||||
loop {
|
||||
@ -353,7 +353,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||
|
||||
hir::PatKind::Never => PatKind::Never,
|
||||
|
||||
hir::PatKind::Expr(value) => self.lower_lit(value),
|
||||
hir::PatKind::Expr(value) => self.lower_pat_expr(value),
|
||||
|
||||
hir::PatKind::Range(ref lo_expr, ref hi_expr, end) => {
|
||||
let (lo_expr, hi_expr) = (lo_expr.as_deref(), hi_expr.as_deref());
|
||||
@ -638,54 +638,57 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||
let ty = self.typeck_results.node_type(id);
|
||||
let res = self.typeck_results.qpath_res(qpath, id);
|
||||
|
||||
let pat_from_kind = |kind| Box::new(Pat { span, ty, kind });
|
||||
let (def_id, user_ty) = match res {
|
||||
Res::Def(DefKind::Const, def_id) => (def_id, None),
|
||||
Res::Def(DefKind::AssocConst, def_id) => {
|
||||
(def_id, self.typeck_results.user_provided_types().get(id))
|
||||
}
|
||||
|
||||
let (def_id, is_associated_const) = match res {
|
||||
Res::Def(DefKind::Const, def_id) => (def_id, false),
|
||||
Res::Def(DefKind::AssocConst, def_id) => (def_id, true),
|
||||
|
||||
_ => return pat_from_kind(self.lower_variant_or_leaf(res, id, span, ty, vec![])),
|
||||
_ => {
|
||||
// The path isn't the name of a constant, so it must actually
|
||||
// be a unit struct or unit variant (e.g. `Option::None`).
|
||||
let kind = self.lower_variant_or_leaf(res, id, span, ty, vec![]);
|
||||
return Box::new(Pat { span, ty, kind });
|
||||
}
|
||||
};
|
||||
|
||||
// Lower the named constant to a THIR pattern.
|
||||
let args = self.typeck_results.node_args(id);
|
||||
let c = ty::Const::new_unevaluated(self.tcx, ty::UnevaluatedConst { def: def_id, args });
|
||||
let subpattern = self.const_to_pat(c, ty, id, span);
|
||||
let pattern = Box::new(Pat {
|
||||
span,
|
||||
ty,
|
||||
kind: PatKind::ExpandedConstant { subpattern, def_id, is_inline: false },
|
||||
});
|
||||
|
||||
if !is_associated_const {
|
||||
return pattern;
|
||||
}
|
||||
// Wrap the pattern in a marker node to indicate that it is the result
|
||||
// of lowering a named constant. This marker is used for improved
|
||||
// diagnostics in some situations, but has no effect at runtime.
|
||||
let mut pattern = {
|
||||
let kind = PatKind::ExpandedConstant { subpattern, def_id, is_inline: false };
|
||||
Box::new(Pat { span, ty, kind })
|
||||
};
|
||||
|
||||
let user_provided_types = self.typeck_results.user_provided_types();
|
||||
if let Some(&user_ty) = user_provided_types.get(id) {
|
||||
// If this is an associated constant with an explicit user-written
|
||||
// type, add an ascription node (e.g. `<Foo<'a> as MyTrait>::CONST`).
|
||||
if let Some(&user_ty) = user_ty {
|
||||
let annotation = CanonicalUserTypeAnnotation {
|
||||
user_ty: Box::new(user_ty),
|
||||
span,
|
||||
inferred_ty: self.typeck_results.node_type(id),
|
||||
};
|
||||
Box::new(Pat {
|
||||
span,
|
||||
kind: PatKind::AscribeUserType {
|
||||
subpattern: pattern,
|
||||
ascription: Ascription {
|
||||
annotation,
|
||||
// Note that use `Contravariant` here. See the
|
||||
// `variance` field documentation for details.
|
||||
variance: ty::Contravariant,
|
||||
},
|
||||
let kind = PatKind::AscribeUserType {
|
||||
subpattern: pattern,
|
||||
ascription: Ascription {
|
||||
annotation,
|
||||
// Note that we use `Contravariant` here. See the
|
||||
// `variance` field documentation for details.
|
||||
variance: ty::Contravariant,
|
||||
},
|
||||
ty,
|
||||
})
|
||||
} else {
|
||||
pattern
|
||||
};
|
||||
pattern = Box::new(Pat { span, kind, ty });
|
||||
}
|
||||
|
||||
pattern
|
||||
}
|
||||
|
||||
/// Converts inline const patterns.
|
||||
/// Lowers an inline const block (e.g. `const { 1 + 1 }`) to a pattern.
|
||||
fn lower_inline_const(
|
||||
&mut self,
|
||||
block: &'tcx hir::ConstBlock,
|
||||
@ -705,14 +708,17 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||
|
||||
let ct = ty::UnevaluatedConst { def: def_id.to_def_id(), args };
|
||||
let subpattern = self.const_to_pat(ty::Const::new_unevaluated(self.tcx, ct), ty, id, span);
|
||||
|
||||
// Wrap the pattern in a marker node to indicate that it is the result
|
||||
// of lowering an inline const block.
|
||||
PatKind::ExpandedConstant { subpattern, def_id: def_id.to_def_id(), is_inline: true }
|
||||
}
|
||||
|
||||
/// Converts literals, paths and negation of literals to patterns.
|
||||
/// The special case for negation exists to allow things like `-128_i8`
|
||||
/// which would overflow if we tried to evaluate `128_i8` and then negate
|
||||
/// afterwards.
|
||||
fn lower_lit(&mut self, expr: &'tcx hir::PatExpr<'tcx>) -> PatKind<'tcx> {
|
||||
/// Lowers the kinds of "expression" that can appear in a HIR pattern:
|
||||
/// - Paths (e.g. `FOO`, `foo::BAR`, `Option::None`)
|
||||
/// - Inline const blocks (e.g. `const { 1 + 1 }`)
|
||||
/// - Literals, possibly negated (e.g. `-128u8`, `"hello"`)
|
||||
fn lower_pat_expr(&mut self, expr: &'tcx hir::PatExpr<'tcx>) -> PatKind<'tcx> {
|
||||
let (lit, neg) = match &expr.kind {
|
||||
hir::PatExprKind::Path(qpath) => {
|
||||
return self.lower_path(qpath, expr.hir_id, expr.span).kind;
|
||||
|
@ -2442,6 +2442,32 @@ impl<'a> Extend<Cow<'a, str>> for String {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "ascii_char", issue = "110998")]
|
||||
impl Extend<core::ascii::Char> for String {
|
||||
fn extend<I: IntoIterator<Item = core::ascii::Char>>(&mut self, iter: I) {
|
||||
self.vec.extend(iter.into_iter().map(|c| c.to_u8()));
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn extend_one(&mut self, c: core::ascii::Char) {
|
||||
self.vec.push(c.to_u8());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[unstable(feature = "ascii_char", issue = "110998")]
|
||||
impl<'a> Extend<&'a core::ascii::Char> for String {
|
||||
fn extend<I: IntoIterator<Item = &'a core::ascii::Char>>(&mut self, iter: I) {
|
||||
self.extend(iter.into_iter().cloned());
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn extend_one(&mut self, c: &'a core::ascii::Char) {
|
||||
self.vec.push(c.to_u8());
|
||||
}
|
||||
}
|
||||
|
||||
/// A convenience impl that delegates to the impl for `&str`.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -420,14 +420,14 @@ pub use self::adapters::{Intersperse, IntersperseWith};
|
||||
issue = "42168"
|
||||
)]
|
||||
pub use self::range::Step;
|
||||
#[stable(feature = "iter_empty", since = "1.2.0")]
|
||||
pub use self::sources::{Empty, empty};
|
||||
#[unstable(
|
||||
feature = "iter_from_coroutine",
|
||||
issue = "43122",
|
||||
reason = "coroutines are unstable"
|
||||
)]
|
||||
pub use self::sources::from_coroutine;
|
||||
#[stable(feature = "iter_empty", since = "1.2.0")]
|
||||
pub use self::sources::{Empty, empty};
|
||||
pub use self::sources::{FromCoroutine, from_coroutine};
|
||||
#[stable(feature = "iter_from_fn", since = "1.34.0")]
|
||||
pub use self::sources::{FromFn, from_fn};
|
||||
#[stable(feature = "iter_once", since = "1.2.0")]
|
||||
|
@ -15,7 +15,7 @@ pub use self::empty::{Empty, empty};
|
||||
issue = "43122",
|
||||
reason = "coroutines are unstable"
|
||||
)]
|
||||
pub use self::from_coroutine::from_coroutine;
|
||||
pub use self::from_coroutine::{FromCoroutine, from_coroutine};
|
||||
#[stable(feature = "iter_from_fn", since = "1.34.0")]
|
||||
pub use self::from_fn::{FromFn, from_fn};
|
||||
#[stable(feature = "iter_once", since = "1.2.0")]
|
||||
|
@ -32,6 +32,16 @@ macro_rules! define_valid_range_type {
|
||||
};
|
||||
|
||||
impl $name {
|
||||
#[inline]
|
||||
pub const fn new(val: $int) -> Option<Self> {
|
||||
if (val as $uint) >= ($low as $uint) && (val as $uint) <= ($high as $uint) {
|
||||
// SAFETY: just checked the inclusive range
|
||||
Some(unsafe { $name(val) })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Constructs an instance of this type from the underlying integer
|
||||
/// primitive without checking whether its zero.
|
||||
///
|
||||
|
@ -26,3 +26,15 @@ fn test_debug_control() {
|
||||
assert_eq!(want, format!("{chr:?}"), "byte: {byte}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Tests Extend implementation for ascii::Char.
|
||||
#[test]
|
||||
fn test_extend() {
|
||||
let mut s = String::from("abc");
|
||||
s.extend_one(Char::SmallD);
|
||||
assert_eq!(s, String::from("abcd"));
|
||||
|
||||
let mut s = String::from("abc");
|
||||
s.extend(Char::CapitalA..=Char::CapitalC);
|
||||
assert_eq!(s, String::from("abcABC"));
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#![feature(duration_constructors)]
|
||||
#![feature(error_generic_member_access)]
|
||||
#![feature(exact_size_is_empty)]
|
||||
#![feature(extend_one)]
|
||||
#![feature(extern_types)]
|
||||
#![feature(float_minimum_maximum)]
|
||||
#![feature(flt2dec)]
|
||||
|
@ -45,6 +45,7 @@ impl<R: Read + ?Sized> Read for &mut R {
|
||||
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
|
||||
(**self).read_exact(buf)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
|
||||
(**self).read_buf_exact(cursor)
|
||||
@ -77,6 +78,11 @@ impl<W: Write + ?Sized> Write for &mut W {
|
||||
(**self).write_all(buf)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
|
||||
(**self).write_all_vectored(bufs)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
|
||||
(**self).write_fmt(fmt)
|
||||
@ -89,10 +95,25 @@ impl<S: Seek + ?Sized> Seek for &mut S {
|
||||
(**self).seek(pos)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn rewind(&mut self) -> io::Result<()> {
|
||||
(**self).rewind()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn stream_len(&mut self) -> io::Result<u64> {
|
||||
(**self).stream_len()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn stream_position(&mut self) -> io::Result<u64> {
|
||||
(**self).stream_position()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn seek_relative(&mut self, offset: i64) -> io::Result<()> {
|
||||
(**self).seek_relative(offset)
|
||||
}
|
||||
}
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<B: BufRead + ?Sized> BufRead for &mut B {
|
||||
@ -106,11 +127,21 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
|
||||
(**self).consume(amt)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_data_left(&mut self) -> io::Result<bool> {
|
||||
(**self).has_data_left()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> {
|
||||
(**self).read_until(byte, buf)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn skip_until(&mut self, byte: u8) -> io::Result<usize> {
|
||||
(**self).skip_until(byte)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
|
||||
(**self).read_line(buf)
|
||||
@ -153,6 +184,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
|
||||
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
|
||||
(**self).read_exact(buf)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
|
||||
(**self).read_buf_exact(cursor)
|
||||
@ -185,6 +217,11 @@ impl<W: Write + ?Sized> Write for Box<W> {
|
||||
(**self).write_all(buf)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
|
||||
(**self).write_all_vectored(bufs)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
|
||||
(**self).write_fmt(fmt)
|
||||
@ -197,10 +234,25 @@ impl<S: Seek + ?Sized> Seek for Box<S> {
|
||||
(**self).seek(pos)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn rewind(&mut self) -> io::Result<()> {
|
||||
(**self).rewind()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn stream_len(&mut self) -> io::Result<u64> {
|
||||
(**self).stream_len()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn stream_position(&mut self) -> io::Result<u64> {
|
||||
(**self).stream_position()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn seek_relative(&mut self, offset: i64) -> io::Result<()> {
|
||||
(**self).seek_relative(offset)
|
||||
}
|
||||
}
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<B: BufRead + ?Sized> BufRead for Box<B> {
|
||||
@ -214,11 +266,21 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
|
||||
(**self).consume(amt)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_data_left(&mut self) -> io::Result<bool> {
|
||||
(**self).has_data_left()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> {
|
||||
(**self).read_until(byte, buf)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn skip_until(&mut self, byte: u8) -> io::Result<usize> {
|
||||
(**self).skip_until(byte)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
|
||||
(**self).read_line(buf)
|
||||
|
@ -67,13 +67,11 @@ impl BorrowedFd<'_> {
|
||||
/// The resource pointed to by `fd` must remain open for the duration of
|
||||
/// the returned `BorrowedFd`, and it must not have the value `-1`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[rustc_const_stable(feature = "io_safety", since = "1.63.0")]
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
pub const unsafe fn borrow_raw(fd: RawFd) -> Self {
|
||||
assert!(fd != u32::MAX as RawFd);
|
||||
// SAFETY: we just asserted that the value is in the valid range and isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned)
|
||||
let fd = unsafe { ValidRawFd::new_unchecked(fd) };
|
||||
Self { fd, _phantom: PhantomData }
|
||||
Self { fd: ValidRawFd::new(fd).expect("fd != -1"), _phantom: PhantomData }
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,11 +152,9 @@ impl FromRawFd for OwnedFd {
|
||||
///
|
||||
/// [io-safety]: io#io-safety
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
unsafe fn from_raw_fd(fd: RawFd) -> Self {
|
||||
assert_ne!(fd, u32::MAX as RawFd);
|
||||
// SAFETY: we just asserted that the value is in the valid range and isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned)
|
||||
let fd = unsafe { ValidRawFd::new_unchecked(fd) };
|
||||
Self { fd }
|
||||
Self { fd: ValidRawFd::new(fd).expect("fd != -1") }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,12 +101,9 @@ impl BorrowedFd<'_> {
|
||||
/// the returned `BorrowedFd`, and it must not have the value
|
||||
/// `SOLID_NET_INVALID_FD`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub const unsafe fn borrow_raw(fd: RawFd) -> Self {
|
||||
assert!(fd != -1 as RawFd);
|
||||
// SAFETY: we just asserted that the value is in the valid range and
|
||||
// isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned)
|
||||
let fd = unsafe { ValidRawFd::new_unchecked(fd) };
|
||||
Self { fd, _phantom: PhantomData }
|
||||
Self { fd: ValidRawFd::new(fd).expect("fd != -1"), _phantom: PhantomData }
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,12 +153,9 @@ impl FromRawFd for OwnedFd {
|
||||
/// The resource pointed to by `fd` must be open and suitable for assuming
|
||||
/// ownership. The resource must not require any cleanup other than `close`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
unsafe fn from_raw_fd(fd: RawFd) -> Self {
|
||||
assert_ne!(fd, -1 as RawFd);
|
||||
// SAFETY: we just asserted that the value is in the valid range and
|
||||
// isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned)
|
||||
let fd = unsafe { ValidRawFd::new_unchecked(fd) };
|
||||
Self { fd }
|
||||
Self { fd: ValidRawFd::new(fd).expect("fd != -1") }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,12 +58,11 @@ impl BorrowedSocket<'_> {
|
||||
/// the returned `BorrowedSocket`, and it must not have the value
|
||||
/// `INVALID_SOCKET`.
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[rustc_const_stable(feature = "io_safety", since = "1.63.0")]
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
pub const unsafe fn borrow_raw(socket: RawSocket) -> Self {
|
||||
assert!(socket != sys::c::INVALID_SOCKET as RawSocket);
|
||||
let socket = unsafe { ValidRawSocket::new_unchecked(socket) };
|
||||
Self { socket, _phantom: PhantomData }
|
||||
Self { socket: ValidRawSocket::new(socket).expect("socket != -1"), _phantom: PhantomData }
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,10 +184,9 @@ impl IntoRawSocket for OwnedSocket {
|
||||
#[stable(feature = "io_safety", since = "1.63.0")]
|
||||
impl FromRawSocket for OwnedSocket {
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
unsafe fn from_raw_socket(socket: RawSocket) -> Self {
|
||||
debug_assert_ne!(socket, sys::c::INVALID_SOCKET as RawSocket);
|
||||
let socket = unsafe { ValidRawSocket::new_unchecked(socket) };
|
||||
Self { socket }
|
||||
Self { socket: ValidRawSocket::new(socket).expect("socket != -1") }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,9 @@ struct FileDesc {
|
||||
|
||||
impl FileDesc {
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
fn new(fd: c_int) -> FileDesc {
|
||||
assert_ne!(fd, -1i32);
|
||||
// Safety: we just asserted that the value is in the valid range and
|
||||
// isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned)
|
||||
let fd = unsafe { CIntNotMinusOne::new_unchecked(fd) };
|
||||
FileDesc { fd }
|
||||
FileDesc { fd: CIntNotMinusOne::new(fd).expect("fd != -1") }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,14 @@
|
||||
// Bindings generated by `windows-bindgen` 0.58.0
|
||||
// Bindings generated by `windows-bindgen` 0.59.0
|
||||
|
||||
#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)]
|
||||
windows_targets::link!("advapi32.dll" "system" fn OpenProcessToken(processhandle : HANDLE, desiredaccess : TOKEN_ACCESS_MASK, tokenhandle : *mut HANDLE) -> BOOL);
|
||||
windows_targets::link!("advapi32.dll" "system" "SystemFunction036" fn RtlGenRandom(randombuffer : *mut core::ffi::c_void, randombufferlength : u32) -> BOOLEAN);
|
||||
|
||||
windows_targets::link!("kernel32.dll" "system" fn AcquireSRWLockExclusive(srwlock : *mut SRWLOCK));
|
||||
windows_targets::link!("kernel32.dll" "system" fn AcquireSRWLockShared(srwlock : *mut SRWLOCK));
|
||||
windows_targets::link!("kernel32.dll" "system" fn AddVectoredExceptionHandler(first : u32, handler : PVECTORED_EXCEPTION_HANDLER) -> *mut core::ffi::c_void);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CancelIo(hfile : HANDLE) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CloseHandle(hobject : HANDLE) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CompareStringOrdinal(lpstring1 : PCWSTR, cchcount1 : i32, lpstring2 : PCWSTR, cchcount2 : i32, bignorecase : BOOL) -> COMPARESTRING_RESULT);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CopyFileExW(lpexistingfilename : PCWSTR, lpnewfilename : PCWSTR, lpprogressroutine : LPPROGRESS_ROUTINE, lpdata : *const core::ffi::c_void, pbcancel : *mut BOOL, dwcopyflags : u32) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CopyFileExW(lpexistingfilename : PCWSTR, lpnewfilename : PCWSTR, lpprogressroutine : LPPROGRESS_ROUTINE, lpdata : *const core::ffi::c_void, pbcancel : *mut BOOL, dwcopyflags : COPYFILE_FLAGS) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateDirectoryW(lppathname : PCWSTR, lpsecurityattributes : *const SECURITY_ATTRIBUTES) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateEventW(lpeventattributes : *const SECURITY_ATTRIBUTES, bmanualreset : BOOL, binitialstate : BOOL, lpname : PCWSTR) -> HANDLE);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateFileW(lpfilename : PCWSTR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, lpsecurityattributes : *const SECURITY_ATTRIBUTES, dwcreationdisposition : FILE_CREATION_DISPOSITION, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES, htemplatefile : HANDLE) -> HANDLE);
|
||||
@ -17,7 +16,7 @@ windows_targets::link!("kernel32.dll" "system" fn CreateHardLinkW(lpfilename : P
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateNamedPipeW(lpname : PCWSTR, dwopenmode : FILE_FLAGS_AND_ATTRIBUTES, dwpipemode : NAMED_PIPE_MODE, nmaxinstances : u32, noutbuffersize : u32, ninbuffersize : u32, ndefaulttimeout : u32, lpsecurityattributes : *const SECURITY_ATTRIBUTES) -> HANDLE);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreatePipe(hreadpipe : *mut HANDLE, hwritepipe : *mut HANDLE, lppipeattributes : *const SECURITY_ATTRIBUTES, nsize : u32) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateProcessW(lpapplicationname : PCWSTR, lpcommandline : PWSTR, lpprocessattributes : *const SECURITY_ATTRIBUTES, lpthreadattributes : *const SECURITY_ATTRIBUTES, binherithandles : BOOL, dwcreationflags : PROCESS_CREATION_FLAGS, lpenvironment : *const core::ffi::c_void, lpcurrentdirectory : PCWSTR, lpstartupinfo : *const STARTUPINFOW, lpprocessinformation : *mut PROCESS_INFORMATION) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateSymbolicLinkW(lpsymlinkfilename : PCWSTR, lptargetfilename : PCWSTR, dwflags : SYMBOLIC_LINK_FLAGS) -> BOOLEAN);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateSymbolicLinkW(lpsymlinkfilename : PCWSTR, lptargetfilename : PCWSTR, dwflags : SYMBOLIC_LINK_FLAGS) -> bool);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateThread(lpthreadattributes : *const SECURITY_ATTRIBUTES, dwstacksize : usize, lpstartaddress : LPTHREAD_START_ROUTINE, lpparameter : *const core::ffi::c_void, dwcreationflags : THREAD_CREATION_FLAGS, lpthreadid : *mut u32) -> HANDLE);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CreateWaitableTimerExW(lptimerattributes : *const SECURITY_ATTRIBUTES, lptimername : PCWSTR, dwflags : u32, dwdesiredaccess : u32) -> HANDLE);
|
||||
windows_targets::link!("kernel32.dll" "system" fn DeleteFileW(lpfilename : PCWSTR) -> BOOL);
|
||||
@ -61,6 +60,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetSystemInfo(lpsysteminfo : *
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetTempPathW(nbufferlength : u32, lpbuffer : PWSTR) -> u32);
|
||||
windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetWindowsDirectoryW(lpbuffer : PWSTR, usize : u32) -> u32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn InitOnceBeginInitialize(lpinitonce : *mut INIT_ONCE, dwflags : u32, fpending : *mut BOOL, lpcontext : *mut *mut core::ffi::c_void) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn InitOnceComplete(lpinitonce : *mut INIT_ONCE, dwflags : u32, lpcontext : *const core::ffi::c_void) -> BOOL);
|
||||
@ -69,6 +69,11 @@ windows_targets::link!("kernel32.dll" "system" fn LocalFree(hmem : HLOCAL) -> HL
|
||||
windows_targets::link!("kernel32.dll" "system" fn LockFileEx(hfile : HANDLE, dwflags : LOCK_FILE_FLAGS, dwreserved : u32, nnumberofbytestolocklow : u32, nnumberofbytestolockhigh : u32, lpoverlapped : *mut OVERLAPPED) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn MoveFileExW(lpexistingfilename : PCWSTR, lpnewfilename : PCWSTR, dwflags : MOVE_FILE_FLAGS) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn MultiByteToWideChar(codepage : u32, dwflags : MULTI_BYTE_TO_WIDE_CHAR_FLAGS, lpmultibytestr : PCSTR, cbmultibyte : i32, lpwidecharstr : PWSTR, cchwidechar : i32) -> i32);
|
||||
windows_targets::link!("ntdll.dll" "system" fn NtCreateFile(filehandle : *mut HANDLE, desiredaccess : FILE_ACCESS_RIGHTS, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, allocationsize : *const i64, fileattributes : FILE_FLAGS_AND_ATTRIBUTES, shareaccess : FILE_SHARE_MODE, createdisposition : NTCREATEFILE_CREATE_DISPOSITION, createoptions : NTCREATEFILE_CREATE_OPTIONS, eabuffer : *const core::ffi::c_void, ealength : u32) -> NTSTATUS);
|
||||
windows_targets::link!("ntdll.dll" "system" fn NtOpenFile(filehandle : *mut HANDLE, desiredaccess : u32, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, shareaccess : u32, openoptions : u32) -> NTSTATUS);
|
||||
windows_targets::link!("ntdll.dll" "system" fn NtReadFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *mut core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS);
|
||||
windows_targets::link!("ntdll.dll" "system" fn NtWriteFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *const core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS);
|
||||
windows_targets::link!("advapi32.dll" "system" fn OpenProcessToken(processhandle : HANDLE, desiredaccess : TOKEN_ACCESS_MASK, tokenhandle : *mut HANDLE) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn QueryPerformanceCounter(lpperformancecount : *mut i64) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn QueryPerformanceFrequency(lpfrequency : *mut i64) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn ReadConsoleW(hconsoleinput : HANDLE, lpbuffer : *mut core::ffi::c_void, nnumberofcharstoread : u32, lpnumberofcharsread : *mut u32, pinputcontrol : *const CONSOLE_READCONSOLE_CONTROL) -> BOOL);
|
||||
@ -77,6 +82,8 @@ windows_targets::link!("kernel32.dll" "system" fn ReadFileEx(hfile : HANDLE, lpb
|
||||
windows_targets::link!("kernel32.dll" "system" fn ReleaseSRWLockExclusive(srwlock : *mut SRWLOCK));
|
||||
windows_targets::link!("kernel32.dll" "system" fn ReleaseSRWLockShared(srwlock : *mut SRWLOCK));
|
||||
windows_targets::link!("kernel32.dll" "system" fn RemoveDirectoryW(lppathname : PCWSTR) -> BOOL);
|
||||
windows_targets::link!("advapi32.dll" "system" "SystemFunction036" fn RtlGenRandom(randombuffer : *mut core::ffi::c_void, randombufferlength : u32) -> bool);
|
||||
windows_targets::link!("ntdll.dll" "system" fn RtlNtStatusToDosError(status : NTSTATUS) -> u32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn SetCurrentDirectoryW(lppathname : PCWSTR) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn SetEnvironmentVariableW(lpname : PCWSTR, lpvalue : PCWSTR) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn SetFileAttributesW(lpfilename : PCWSTR, dwfileattributes : FILE_FLAGS_AND_ATTRIBUTES) -> BOOL);
|
||||
@ -96,23 +103,10 @@ windows_targets::link!("kernel32.dll" "system" fn TlsAlloc() -> u32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn TlsFree(dwtlsindex : u32) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn TlsGetValue(dwtlsindex : u32) -> *mut core::ffi::c_void);
|
||||
windows_targets::link!("kernel32.dll" "system" fn TlsSetValue(dwtlsindex : u32, lptlsvalue : *const core::ffi::c_void) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockExclusive(srwlock : *mut SRWLOCK) -> BOOLEAN);
|
||||
windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockShared(srwlock : *mut SRWLOCK) -> BOOLEAN);
|
||||
windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockExclusive(srwlock : *mut SRWLOCK) -> bool);
|
||||
windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockShared(srwlock : *mut SRWLOCK) -> bool);
|
||||
windows_targets::link!("kernel32.dll" "system" fn UnlockFile(hfile : HANDLE, dwfileoffsetlow : u32, dwfileoffsethigh : u32, nnumberofbytestounlocklow : u32, nnumberofbytestounlockhigh : u32) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn UpdateProcThreadAttribute(lpattributelist : LPPROC_THREAD_ATTRIBUTE_LIST, dwflags : u32, attribute : usize, lpvalue : *const core::ffi::c_void, cbsize : usize, lppreviousvalue : *mut core::ffi::c_void, lpreturnsize : *const usize) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WaitForMultipleObjects(ncount : u32, lphandles : *const HANDLE, bwaitall : BOOL, dwmilliseconds : u32) -> WAIT_EVENT);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WakeAllConditionVariable(conditionvariable : *mut CONDITION_VARIABLE));
|
||||
windows_targets::link!("kernel32.dll" "system" fn WakeConditionVariable(conditionvariable : *mut CONDITION_VARIABLE));
|
||||
windows_targets::link!("kernel32.dll" "system" fn WideCharToMultiByte(codepage : u32, dwflags : u32, lpwidecharstr : PCWSTR, cchwidechar : i32, lpmultibytestr : PSTR, cbmultibyte : i32, lpdefaultchar : PCSTR, lpuseddefaultchar : *mut BOOL) -> i32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WriteConsoleW(hconsoleoutput : HANDLE, lpbuffer : PCWSTR, nnumberofcharstowrite : u32, lpnumberofcharswritten : *mut u32, lpreserved : *const core::ffi::c_void) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WriteFileEx(hfile : HANDLE, lpbuffer : *const u8, nnumberofbytestowrite : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPOVERLAPPED_COMPLETION_ROUTINE) -> BOOL);
|
||||
windows_targets::link!("ntdll.dll" "system" fn NtCreateFile(filehandle : *mut HANDLE, desiredaccess : FILE_ACCESS_RIGHTS, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, allocationsize : *const i64, fileattributes : FILE_FLAGS_AND_ATTRIBUTES, shareaccess : FILE_SHARE_MODE, createdisposition : NTCREATEFILE_CREATE_DISPOSITION, createoptions : NTCREATEFILE_CREATE_OPTIONS, eabuffer : *const core::ffi::c_void, ealength : u32) -> NTSTATUS);
|
||||
windows_targets::link!("ntdll.dll" "system" fn NtOpenFile(filehandle : *mut HANDLE, desiredaccess : u32, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, shareaccess : u32, openoptions : u32) -> NTSTATUS);
|
||||
windows_targets::link!("ntdll.dll" "system" fn NtReadFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *mut core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS);
|
||||
windows_targets::link!("ntdll.dll" "system" fn NtWriteFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *const core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS);
|
||||
windows_targets::link!("ntdll.dll" "system" fn RtlNtStatusToDosError(status : NTSTATUS) -> u32);
|
||||
windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn WSACleanup() -> i32);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn WSADuplicateSocketW(s : SOCKET, dwprocessid : u32, lpprotocolinfo : *mut WSAPROTOCOL_INFOW) -> i32);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn WSAGetLastError() -> WSA_ERROR);
|
||||
@ -120,6 +114,13 @@ windows_targets::link!("ws2_32.dll" "system" fn WSARecv(s : SOCKET, lpbuffers :
|
||||
windows_targets::link!("ws2_32.dll" "system" fn WSASend(s : SOCKET, lpbuffers : *const WSABUF, dwbuffercount : u32, lpnumberofbytessent : *mut u32, dwflags : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPWSAOVERLAPPED_COMPLETION_ROUTINE) -> i32);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn WSASocketW(af : i32, r#type : i32, protocol : i32, lpprotocolinfo : *const WSAPROTOCOL_INFOW, g : u32, dwflags : u32) -> SOCKET);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn WSAStartup(wversionrequested : u16, lpwsadata : *mut WSADATA) -> i32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WaitForMultipleObjects(ncount : u32, lphandles : *const HANDLE, bwaitall : BOOL, dwmilliseconds : u32) -> WAIT_EVENT);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WakeAllConditionVariable(conditionvariable : *mut CONDITION_VARIABLE));
|
||||
windows_targets::link!("kernel32.dll" "system" fn WakeConditionVariable(conditionvariable : *mut CONDITION_VARIABLE));
|
||||
windows_targets::link!("kernel32.dll" "system" fn WideCharToMultiByte(codepage : u32, dwflags : u32, lpwidecharstr : PCWSTR, cchwidechar : i32, lpmultibytestr : PSTR, cbmultibyte : i32, lpdefaultchar : PCSTR, lpuseddefaultchar : *mut BOOL) -> i32);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WriteConsoleW(hconsoleoutput : HANDLE, lpbuffer : PCWSTR, nnumberofcharstowrite : u32, lpnumberofcharswritten : *mut u32, lpreserved : *const core::ffi::c_void) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn WriteFileEx(hfile : HANDLE, lpbuffer : *const u8, nnumberofbytestowrite : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPOVERLAPPED_COMPLETION_ROUTINE) -> BOOL);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn accept(s : SOCKET, addr : *mut SOCKADDR, addrlen : *mut i32) -> SOCKET);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn bind(s : SOCKET, name : *const SOCKADDR, namelen : i32) -> i32);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn closesocket(s : SOCKET) -> i32);
|
||||
@ -139,6 +140,15 @@ windows_targets::link!("ws2_32.dll" "system" fn sendto(s : SOCKET, buf : PCSTR,
|
||||
windows_targets::link!("ws2_32.dll" "system" fn setsockopt(s : SOCKET, level : i32, optname : i32, optval : PCSTR, optlen : i32) -> i32);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn shutdown(s : SOCKET, how : WINSOCK_SHUTDOWN_HOW) -> i32);
|
||||
pub const ABOVE_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32768u32;
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct ACL {
|
||||
pub AclRevision: u8,
|
||||
pub Sbz1: u8,
|
||||
pub AclSize: u16,
|
||||
pub AceCount: u16,
|
||||
pub Sbz2: u16,
|
||||
}
|
||||
pub type ADDRESS_FAMILY = u16;
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
@ -174,7 +184,6 @@ pub struct ARM64_NT_NEON128_0 {
|
||||
}
|
||||
pub const BELOW_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 16384u32;
|
||||
pub type BOOL = i32;
|
||||
pub type BOOLEAN = u8;
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct BY_HANDLE_FILE_INFORMATION {
|
||||
@ -207,64 +216,34 @@ pub struct CONSOLE_READCONSOLE_CONTROL {
|
||||
pub dwControlKeyState: u32,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CONTEXT {
|
||||
pub ContextFlags: CONTEXT_FLAGS,
|
||||
pub Cpsr: u32,
|
||||
pub Anonymous: CONTEXT_0,
|
||||
pub Sp: u64,
|
||||
pub Pc: u64,
|
||||
pub V: [ARM64_NT_NEON128; 32],
|
||||
pub Fpcr: u32,
|
||||
pub Fpsr: u32,
|
||||
pub Bcr: [u32; 8],
|
||||
pub Bvr: [u64; 8],
|
||||
pub Wcr: [u32; 2],
|
||||
pub Wvr: [u64; 2],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub union CONTEXT_0 {
|
||||
pub Anonymous: CONTEXT_0_0,
|
||||
pub X: [u64; 31],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CONTEXT_0_0 {
|
||||
pub X0: u64,
|
||||
pub X1: u64,
|
||||
pub X2: u64,
|
||||
pub X3: u64,
|
||||
pub X4: u64,
|
||||
pub X5: u64,
|
||||
pub X6: u64,
|
||||
pub X7: u64,
|
||||
pub X8: u64,
|
||||
pub X9: u64,
|
||||
pub X10: u64,
|
||||
pub X11: u64,
|
||||
pub X12: u64,
|
||||
pub X13: u64,
|
||||
pub X14: u64,
|
||||
pub X15: u64,
|
||||
pub X16: u64,
|
||||
pub X17: u64,
|
||||
pub X18: u64,
|
||||
pub X19: u64,
|
||||
pub X20: u64,
|
||||
pub X21: u64,
|
||||
pub X22: u64,
|
||||
pub X23: u64,
|
||||
pub X24: u64,
|
||||
pub X25: u64,
|
||||
pub X26: u64,
|
||||
pub X27: u64,
|
||||
pub X28: u64,
|
||||
pub Fp: u64,
|
||||
pub Lr: u64,
|
||||
pub Dr0: u32,
|
||||
pub Dr1: u32,
|
||||
pub Dr2: u32,
|
||||
pub Dr3: u32,
|
||||
pub Dr6: u32,
|
||||
pub Dr7: u32,
|
||||
pub FloatSave: FLOATING_SAVE_AREA,
|
||||
pub SegGs: u32,
|
||||
pub SegFs: u32,
|
||||
pub SegEs: u32,
|
||||
pub SegDs: u32,
|
||||
pub Edi: u32,
|
||||
pub Esi: u32,
|
||||
pub Ebx: u32,
|
||||
pub Edx: u32,
|
||||
pub Ecx: u32,
|
||||
pub Eax: u32,
|
||||
pub Ebp: u32,
|
||||
pub Eip: u32,
|
||||
pub SegCs: u32,
|
||||
pub EFlags: u32,
|
||||
pub Esp: u32,
|
||||
pub SegSs: u32,
|
||||
pub ExtendedRegisters: [u8; 512],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
|
||||
@ -348,36 +327,68 @@ pub struct CONTEXT_0_0 {
|
||||
pub Xmm15: M128A,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CONTEXT {
|
||||
pub ContextFlags: CONTEXT_FLAGS,
|
||||
pub Dr0: u32,
|
||||
pub Dr1: u32,
|
||||
pub Dr2: u32,
|
||||
pub Dr3: u32,
|
||||
pub Dr6: u32,
|
||||
pub Dr7: u32,
|
||||
pub FloatSave: FLOATING_SAVE_AREA,
|
||||
pub SegGs: u32,
|
||||
pub SegFs: u32,
|
||||
pub SegEs: u32,
|
||||
pub SegDs: u32,
|
||||
pub Edi: u32,
|
||||
pub Esi: u32,
|
||||
pub Ebx: u32,
|
||||
pub Edx: u32,
|
||||
pub Ecx: u32,
|
||||
pub Eax: u32,
|
||||
pub Ebp: u32,
|
||||
pub Eip: u32,
|
||||
pub SegCs: u32,
|
||||
pub EFlags: u32,
|
||||
pub Esp: u32,
|
||||
pub SegSs: u32,
|
||||
pub ExtendedRegisters: [u8; 512],
|
||||
pub Cpsr: u32,
|
||||
pub Anonymous: CONTEXT_0,
|
||||
pub Sp: u64,
|
||||
pub Pc: u64,
|
||||
pub V: [ARM64_NT_NEON128; 32],
|
||||
pub Fpcr: u32,
|
||||
pub Fpsr: u32,
|
||||
pub Bcr: [u32; 8],
|
||||
pub Bvr: [u64; 8],
|
||||
pub Wcr: [u32; 2],
|
||||
pub Wvr: [u64; 2],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub union CONTEXT_0 {
|
||||
pub Anonymous: CONTEXT_0_0,
|
||||
pub X: [u64; 31],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CONTEXT_0_0 {
|
||||
pub X0: u64,
|
||||
pub X1: u64,
|
||||
pub X2: u64,
|
||||
pub X3: u64,
|
||||
pub X4: u64,
|
||||
pub X5: u64,
|
||||
pub X6: u64,
|
||||
pub X7: u64,
|
||||
pub X8: u64,
|
||||
pub X9: u64,
|
||||
pub X10: u64,
|
||||
pub X11: u64,
|
||||
pub X12: u64,
|
||||
pub X13: u64,
|
||||
pub X14: u64,
|
||||
pub X15: u64,
|
||||
pub X16: u64,
|
||||
pub X17: u64,
|
||||
pub X18: u64,
|
||||
pub X19: u64,
|
||||
pub X20: u64,
|
||||
pub X21: u64,
|
||||
pub X22: u64,
|
||||
pub X23: u64,
|
||||
pub X24: u64,
|
||||
pub X25: u64,
|
||||
pub X26: u64,
|
||||
pub X27: u64,
|
||||
pub X28: u64,
|
||||
pub Fp: u64,
|
||||
pub Lr: u64,
|
||||
}
|
||||
pub type CONTEXT_FLAGS = u32;
|
||||
pub type COPYFILE_FLAGS = u32;
|
||||
pub type COPYPROGRESSROUTINE_PROGRESS = u32;
|
||||
pub const CP_UTF8: u32 = 65001u32;
|
||||
pub const CREATE_ALWAYS: FILE_CREATION_DISPOSITION = 2u32;
|
||||
pub const CREATE_BREAKAWAY_FROM_JOB: PROCESS_CREATION_FLAGS = 16777216u32;
|
||||
@ -2396,7 +2407,7 @@ pub const FILE_DISPOSITION_FLAG_POSIX_SEMANTICS: FILE_DISPOSITION_INFO_EX_FLAGS
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct FILE_DISPOSITION_INFO {
|
||||
pub DeleteFile: BOOLEAN,
|
||||
pub DeleteFile: bool,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
@ -2486,7 +2497,7 @@ pub struct FILE_RENAME_INFO {
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub union FILE_RENAME_INFO_0 {
|
||||
pub ReplaceIfExists: BOOLEAN,
|
||||
pub ReplaceIfExists: bool,
|
||||
pub Flags: u32,
|
||||
}
|
||||
pub const FILE_RESERVE_OPFILTER: NTCREATEFILE_CREATE_OPTIONS = 1048576u32;
|
||||
@ -2503,8 +2514,8 @@ pub struct FILE_STANDARD_INFO {
|
||||
pub AllocationSize: i64,
|
||||
pub EndOfFile: i64,
|
||||
pub NumberOfLinks: u32,
|
||||
pub DeletePending: BOOLEAN,
|
||||
pub Directory: BOOLEAN,
|
||||
pub DeletePending: bool,
|
||||
pub Directory: bool,
|
||||
}
|
||||
pub const FILE_SUPERSEDE: NTCREATEFILE_CREATE_DISPOSITION = 0u32;
|
||||
pub const FILE_SYNCHRONOUS_IO_ALERT: NTCREATEFILE_CREATE_OPTIONS = 16u32;
|
||||
@ -2525,20 +2536,6 @@ pub type FINDEX_SEARCH_OPS = i32;
|
||||
pub type FIND_FIRST_EX_FLAGS = u32;
|
||||
pub const FIONBIO: i32 = -2147195266i32;
|
||||
#[repr(C)]
|
||||
#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct FLOATING_SAVE_AREA {
|
||||
pub ControlWord: u32,
|
||||
pub StatusWord: u32,
|
||||
pub TagWord: u32,
|
||||
pub ErrorOffset: u32,
|
||||
pub ErrorSelector: u32,
|
||||
pub DataOffset: u32,
|
||||
pub DataSelector: u32,
|
||||
pub RegisterArea: [u8; 80],
|
||||
pub Cr0NpxState: u32,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct FLOATING_SAVE_AREA {
|
||||
@ -2552,6 +2549,20 @@ pub struct FLOATING_SAVE_AREA {
|
||||
pub RegisterArea: [u8; 80],
|
||||
pub Spare0: u32,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct FLOATING_SAVE_AREA {
|
||||
pub ControlWord: u32,
|
||||
pub StatusWord: u32,
|
||||
pub TagWord: u32,
|
||||
pub ErrorOffset: u32,
|
||||
pub ErrorSelector: u32,
|
||||
pub DataOffset: u32,
|
||||
pub DataSelector: u32,
|
||||
pub RegisterArea: [u8; 80],
|
||||
pub Cr0NpxState: u32,
|
||||
}
|
||||
pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: FORMAT_MESSAGE_OPTIONS = 256u32;
|
||||
pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: FORMAT_MESSAGE_OPTIONS = 8192u32;
|
||||
pub const FORMAT_MESSAGE_FROM_HMODULE: FORMAT_MESSAGE_OPTIONS = 2048u32;
|
||||
@ -2618,6 +2629,7 @@ pub type HANDLE_FLAGS = u32;
|
||||
pub const HANDLE_FLAG_INHERIT: HANDLE_FLAGS = 1u32;
|
||||
pub const HANDLE_FLAG_PROTECT_FROM_CLOSE: HANDLE_FLAGS = 2u32;
|
||||
pub const HIGH_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 128u32;
|
||||
pub type HINSTANCE = *mut core::ffi::c_void;
|
||||
pub type HLOCAL = *mut core::ffi::c_void;
|
||||
pub type HMODULE = *mut core::ffi::c_void;
|
||||
pub type HRESULT = i32;
|
||||
@ -2771,7 +2783,7 @@ pub type LPPROGRESS_ROUTINE = Option<
|
||||
hsourcefile: HANDLE,
|
||||
hdestinationfile: HANDLE,
|
||||
lpdata: *const core::ffi::c_void,
|
||||
) -> u32,
|
||||
) -> COPYPROGRESSROUTINE_PROGRESS,
|
||||
>;
|
||||
pub type LPPROGRESS_ROUTINE_CALLBACK_REASON = u32;
|
||||
pub type LPTHREAD_START_ROUTINE =
|
||||
@ -2822,11 +2834,12 @@ pub struct OBJECT_ATTRIBUTES {
|
||||
pub Length: u32,
|
||||
pub RootDirectory: HANDLE,
|
||||
pub ObjectName: *const UNICODE_STRING,
|
||||
pub Attributes: u32,
|
||||
pub SecurityDescriptor: *const core::ffi::c_void,
|
||||
pub SecurityQualityOfService: *const core::ffi::c_void,
|
||||
pub Attributes: OBJECT_ATTRIBUTE_FLAGS,
|
||||
pub SecurityDescriptor: *const SECURITY_DESCRIPTOR,
|
||||
pub SecurityQualityOfService: *const SECURITY_QUALITY_OF_SERVICE,
|
||||
}
|
||||
pub const OBJ_DONT_REPARSE: i32 = 4096i32;
|
||||
pub type OBJECT_ATTRIBUTE_FLAGS = u32;
|
||||
pub const OBJ_DONT_REPARSE: OBJECT_ATTRIBUTE_FLAGS = 4096u32;
|
||||
pub const OPEN_ALWAYS: FILE_CREATION_DISPOSITION = 4u32;
|
||||
pub const OPEN_EXISTING: FILE_CREATION_DISPOSITION = 3u32;
|
||||
#[repr(C)]
|
||||
@ -2887,7 +2900,8 @@ pub const PROCESS_MODE_BACKGROUND_END: PROCESS_CREATION_FLAGS = 2097152u32;
|
||||
pub const PROFILE_KERNEL: PROCESS_CREATION_FLAGS = 536870912u32;
|
||||
pub const PROFILE_SERVER: PROCESS_CREATION_FLAGS = 1073741824u32;
|
||||
pub const PROFILE_USER: PROCESS_CREATION_FLAGS = 268435456u32;
|
||||
pub const PROGRESS_CONTINUE: u32 = 0u32;
|
||||
pub const PROGRESS_CONTINUE: COPYPROGRESSROUTINE_PROGRESS = 0u32;
|
||||
pub type PSID = *mut core::ffi::c_void;
|
||||
pub type PSTR = *mut u8;
|
||||
pub type PTIMERAPCROUTINE = Option<
|
||||
unsafe extern "system" fn(
|
||||
@ -2914,9 +2928,30 @@ pub struct SECURITY_ATTRIBUTES {
|
||||
}
|
||||
pub const SECURITY_CONTEXT_TRACKING: FILE_FLAGS_AND_ATTRIBUTES = 262144u32;
|
||||
pub const SECURITY_DELEGATION: FILE_FLAGS_AND_ATTRIBUTES = 196608u32;
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct SECURITY_DESCRIPTOR {
|
||||
pub Revision: u8,
|
||||
pub Sbz1: u8,
|
||||
pub Control: SECURITY_DESCRIPTOR_CONTROL,
|
||||
pub Owner: PSID,
|
||||
pub Group: PSID,
|
||||
pub Sacl: *mut ACL,
|
||||
pub Dacl: *mut ACL,
|
||||
}
|
||||
pub type SECURITY_DESCRIPTOR_CONTROL = u16;
|
||||
pub const SECURITY_EFFECTIVE_ONLY: FILE_FLAGS_AND_ATTRIBUTES = 524288u32;
|
||||
pub const SECURITY_IDENTIFICATION: FILE_FLAGS_AND_ATTRIBUTES = 65536u32;
|
||||
pub const SECURITY_IMPERSONATION: FILE_FLAGS_AND_ATTRIBUTES = 131072u32;
|
||||
pub type SECURITY_IMPERSONATION_LEVEL = i32;
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct SECURITY_QUALITY_OF_SERVICE {
|
||||
pub Length: u32,
|
||||
pub ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL,
|
||||
pub ContextTrackingMode: u8,
|
||||
pub EffectiveOnly: bool,
|
||||
}
|
||||
pub const SECURITY_SQOS_PRESENT: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32;
|
||||
pub const SECURITY_VALID_SQOS_FLAGS: FILE_FLAGS_AND_ATTRIBUTES = 2031616u32;
|
||||
pub type SEND_RECV_FLAGS = i32;
|
||||
@ -3137,18 +3172,6 @@ pub struct WSABUF {
|
||||
pub buf: PSTR,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct WSADATA {
|
||||
pub wVersion: u16,
|
||||
pub wHighVersion: u16,
|
||||
pub iMaxSockets: u16,
|
||||
pub iMaxUdpDg: u16,
|
||||
pub lpVendorInfo: PSTR,
|
||||
pub szDescription: [i8; 257],
|
||||
pub szSystemStatus: [i8; 129],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct WSADATA {
|
||||
@ -3160,6 +3183,18 @@ pub struct WSADATA {
|
||||
pub iMaxUdpDg: u16,
|
||||
pub lpVendorInfo: PSTR,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct WSADATA {
|
||||
pub wVersion: u16,
|
||||
pub wHighVersion: u16,
|
||||
pub iMaxSockets: u16,
|
||||
pub iMaxUdpDg: u16,
|
||||
pub lpVendorInfo: PSTR,
|
||||
pub szDescription: [i8; 257],
|
||||
pub szSystemStatus: [i8; 129],
|
||||
}
|
||||
pub const WSAEACCES: WSA_ERROR = 10013i32;
|
||||
pub const WSAEADDRINUSE: WSA_ERROR = 10048i32;
|
||||
pub const WSAEADDRNOTAVAIL: WSA_ERROR = 10049i32;
|
||||
@ -3293,27 +3328,6 @@ pub const WSA_SECURE_HOST_NOT_FOUND: WSA_ERROR = 11032i32;
|
||||
pub const WSA_WAIT_EVENT_0: WSA_ERROR = 0i32;
|
||||
pub const WSA_WAIT_IO_COMPLETION: WSA_ERROR = 192i32;
|
||||
#[repr(C)]
|
||||
#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct XSAVE_FORMAT {
|
||||
pub ControlWord: u16,
|
||||
pub StatusWord: u16,
|
||||
pub TagWord: u8,
|
||||
pub Reserved1: u8,
|
||||
pub ErrorOpcode: u16,
|
||||
pub ErrorOffset: u32,
|
||||
pub ErrorSelector: u16,
|
||||
pub Reserved2: u16,
|
||||
pub DataOffset: u32,
|
||||
pub DataSelector: u16,
|
||||
pub Reserved3: u16,
|
||||
pub MxCsr: u32,
|
||||
pub MxCsr_Mask: u32,
|
||||
pub FloatRegisters: [M128A; 8],
|
||||
pub XmmRegisters: [M128A; 16],
|
||||
pub Reserved4: [u8; 96],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(target_arch = "x86")]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct XSAVE_FORMAT {
|
||||
@ -3334,6 +3348,27 @@ pub struct XSAVE_FORMAT {
|
||||
pub XmmRegisters: [M128A; 8],
|
||||
pub Reserved4: [u8; 224],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct XSAVE_FORMAT {
|
||||
pub ControlWord: u16,
|
||||
pub StatusWord: u16,
|
||||
pub TagWord: u8,
|
||||
pub Reserved1: u8,
|
||||
pub ErrorOpcode: u16,
|
||||
pub ErrorOffset: u32,
|
||||
pub ErrorSelector: u16,
|
||||
pub Reserved2: u16,
|
||||
pub DataOffset: u32,
|
||||
pub DataSelector: u16,
|
||||
pub Reserved3: u16,
|
||||
pub MxCsr: u32,
|
||||
pub MxCsr_Mask: u32,
|
||||
pub FloatRegisters: [M128A; 8],
|
||||
pub XmmRegisters: [M128A; 16],
|
||||
pub Reserved4: [u8; 96],
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[repr(C)]
|
||||
|
@ -812,7 +812,7 @@ impl File {
|
||||
/// will prevent anyone from opening a new handle to the file.
|
||||
#[allow(unused)]
|
||||
fn win32_delete(&self) -> Result<(), WinError> {
|
||||
let info = c::FILE_DISPOSITION_INFO { DeleteFile: c::TRUE as _ };
|
||||
let info = c::FILE_DISPOSITION_INFO { DeleteFile: true };
|
||||
api::set_file_information_by_handle(self.handle.as_raw_handle(), &info)
|
||||
}
|
||||
|
||||
@ -1372,7 +1372,7 @@ pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
|
||||
if let Err(err) = result {
|
||||
if err.raw_os_error() == Some(c::ERROR_INVALID_PARAMETER as _) {
|
||||
// FileRenameInfoEx and FILE_RENAME_FLAG_POSIX_SEMANTICS were added in Windows 10 1607; retry with FileRenameInfo.
|
||||
file_rename_info.Anonymous.ReplaceIfExists = 1;
|
||||
file_rename_info.Anonymous.ReplaceIfExists = true;
|
||||
|
||||
cvt(unsafe {
|
||||
c::SetFileInformationByHandle(
|
||||
|
@ -99,16 +99,18 @@ prepare:
|
||||
|
||||
# Set of tests that represent around half of the time of the test suite.
|
||||
# Used to split tests across multiple CI runners.
|
||||
STAGE_2_TEST_SET1 := test --stage 2 --skip=compiler --skip=src
|
||||
STAGE_2_TEST_SET2 := test --stage 2 --skip=tests --skip=coverage-map --skip=coverage-run --skip=library --skip=tidyselftest
|
||||
SKIP_COMPILER := --skip=compiler
|
||||
SKIP_SRC := --skip=src
|
||||
TEST_SET1 := $(SKIP_COMPILER) $(SKIP_SRC)
|
||||
TEST_SET2 := --skip=tests --skip=coverage-map --skip=coverage-run --skip=library --skip=tidyselftest
|
||||
|
||||
## MSVC native builders
|
||||
|
||||
# this intentionally doesn't use `$(BOOTSTRAP)` so we can test the shebang on Windows
|
||||
ci-msvc-py:
|
||||
$(Q)$(CFG_SRC_DIR)/x.py $(STAGE_2_TEST_SET1)
|
||||
$(Q)$(CFG_SRC_DIR)/x.py test --stage 2 $(TEST_SET1)
|
||||
ci-msvc-ps1:
|
||||
$(Q)$(CFG_SRC_DIR)/x.ps1 $(STAGE_2_TEST_SET2)
|
||||
$(Q)$(CFG_SRC_DIR)/x.ps1 test --stage 2 $(TEST_SET2)
|
||||
ci-msvc: ci-msvc-py ci-msvc-ps1
|
||||
|
||||
## MingW native builders
|
||||
@ -116,10 +118,14 @@ ci-msvc: ci-msvc-py ci-msvc-ps1
|
||||
# Set of tests that should represent half of the time of the test suite.
|
||||
# Used to split tests across multiple CI runners.
|
||||
# Test both x and bootstrap entrypoints.
|
||||
ci-mingw-x-1:
|
||||
$(Q)$(CFG_SRC_DIR)/x test --stage 2 $(SKIP_COMPILER) $(TEST_SET2)
|
||||
ci-mingw-x-2:
|
||||
$(Q)$(CFG_SRC_DIR)/x test --stage 2 $(SKIP_SRC) $(TEST_SET2)
|
||||
ci-mingw-x:
|
||||
$(Q)$(CFG_SRC_DIR)/x $(STAGE_2_TEST_SET1)
|
||||
$(Q)$(CFG_SRC_DIR)/x test --stage 2 $(TEST_SET1)
|
||||
ci-mingw-bootstrap:
|
||||
$(Q)$(BOOTSTRAP) $(STAGE_2_TEST_SET2)
|
||||
$(Q)$(BOOTSTRAP) test --stage 2 $(TEST_SET2)
|
||||
ci-mingw: ci-mingw-x ci-mingw-bootstrap
|
||||
|
||||
.PHONY: dist
|
||||
|
@ -456,6 +456,7 @@ auto:
|
||||
# Windows Builders #
|
||||
######################
|
||||
|
||||
# x86_64-msvc is split into two jobs to run tests in parallel.
|
||||
- name: x86_64-msvc-1
|
||||
env:
|
||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-sanitizers --enable-profiler
|
||||
@ -527,13 +528,30 @@ auto:
|
||||
# came from the mingw-w64 SourceForge download site. Unfortunately
|
||||
# SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
|
||||
|
||||
- name: i686-mingw
|
||||
# i686-mingw is split into three jobs to run tests in parallel.
|
||||
- name: i686-mingw-1
|
||||
env:
|
||||
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
|
||||
SCRIPT: make ci-mingw
|
||||
SCRIPT: make ci-mingw-x-1
|
||||
# There is no dist-i686-mingw-alt, so there is no prebuilt LLVM with assertions
|
||||
NO_DOWNLOAD_CI_LLVM: 1
|
||||
<<: *job-windows-25-8c
|
||||
<<: *job-windows-25
|
||||
|
||||
- name: i686-mingw-2
|
||||
env:
|
||||
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
|
||||
SCRIPT: make ci-mingw-x-2
|
||||
# There is no dist-i686-mingw-alt, so there is no prebuilt LLVM with assertions
|
||||
NO_DOWNLOAD_CI_LLVM: 1
|
||||
<<: *job-windows-25
|
||||
|
||||
- name: i686-mingw-3
|
||||
env:
|
||||
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
|
||||
SCRIPT: make ci-mingw-bootstrap
|
||||
# There is no dist-i686-mingw-alt, so there is no prebuilt LLVM with assertions
|
||||
NO_DOWNLOAD_CI_LLVM: 1
|
||||
<<: *job-windows-25
|
||||
|
||||
# x86_64-mingw is split into two jobs to run tests in parallel.
|
||||
- name: x86_64-mingw-1
|
||||
|
@ -4,4 +4,4 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies.windows-bindgen]
|
||||
version = "0.58.0"
|
||||
version = "0.59.0"
|
||||
|
@ -29,8 +29,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
sort_bindings("bindings.txt")?;
|
||||
|
||||
let info = windows_bindgen::bindgen(["--etc", "bindings.txt"])?;
|
||||
println!("{info}");
|
||||
windows_bindgen::bindgen(["--etc", "bindings.txt"]);
|
||||
|
||||
let mut f = std::fs::File::options().append(true).open("windows_sys.rs")?;
|
||||
f.write_all(ARM32_SHIM.as_bytes())?;
|
||||
|
Loading…
Reference in New Issue
Block a user