Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 893996
Collapse All | Expand All

(-)a/vendor/io-lifetimes/.cargo-checksum.json (-1 / +1 lines)
Line 1 Link Here
1
{"files":{"CODE_OF_CONDUCT.md":"e0bd80144c93b032dadb144d7cf8663c55d697ba2dd60382715c981dfc60e421","COPYRIGHT":"495c30b45120f8af07cfa26eb9cb1ebfe8324560dca2b3b1e76cad1b9b6b489a","Cargo.toml":"708c0224b000c9eafe3b7b1d7b7ecf86df5b7197974ad8a4475dfe71490ca9f8","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"408d5965c87cc338493f67f638adea97dbd415f4e12638be1365096afa2b8ba3","build.rs":"5809e0c02e95c4e7ddc57a07090b7ae2254cbe1aef493c9a2d720c58e4424556","src/example_ffi.rs":"c369438f2c44b21a5b977d303d6d0f3069a44d56d8ef770da06ddc3dcc967bdf","src/impls_async_std.rs":"62f73e42a2e76a9287f72f1c3db322114d4a08a2d8e2715c04156df60df1f876","src/impls_fs_err.rs":"12333298a291377a8c24835c60dfa3338e413e6435576cede04ce780da84ebe6","src/impls_mio.rs":"32ba71c1912d7dedcb110cb91dd953bab05a039d576c55a7508fcdad1bebbc2b","src/impls_os_pipe.rs":"5075498711f2dfdd6795d3afdb81bd3aca26c033d2f8f7238de59016d3ead0a9","src/impls_socket2.rs":"deacb4dd2c1e19ef483c937b6a18034397d729c3df361de5e748d70f5457f48b","src/impls_std.rs":"4e73f3993f539b7fa22db0b878eb8845d9ecf79f1580382619c83e18cf384fa3","src/impls_tokio.rs":"4f5f3dbdfa9395cd7e5149658cbd3872fa6c3973e1c844b7f6b48ee2e39e9197","src/lib.rs":"02affec86a96402d922c91f27a4dabde12d8dc485f647ae7a847ea12ed394358","src/portability.rs":"3e9929c7c04524d99a481c646f708f29cd5e251bf44dad7115ae381c2bcaab78","src/raw.rs":"2fa1ea37da1cc993e36ce7950b3e2bc635b3ac268dacd5b5520e5bfc84741b4a","src/traits.rs":"7419b21302b5a633dddf6765af706c5c09840a55e004d839f418fdb5f8826b2b","src/types.rs":"ca3729538bcfd3f63379fd1db4cb635b84cc1380d96ec5072403570de062df9c","src/views.rs":"ecc38c14b08566cc1667d530804a86124d90480e7fdecc585b0e4cfff7312807"},"package":"e394faa0efb47f9f227f1cd89978f854542b318a6f64fa695489c9c993056656"}
1
{"files":{},"package":"e394faa0efb47f9f227f1cd89978f854542b318a6f64fa695489c9c993056656"}
(-)a/vendor/io-lifetimes/build.rs (-46 / +38 lines)
Lines 33-102 fn use_feature(feature: &str) { Link Here
33
33
34
/// Test whether the rustc at `var("RUSTC")` supports the given feature.
34
/// Test whether the rustc at `var("RUSTC")` supports the given feature.
35
fn has_feature(feature: &str) -> bool {
35
fn has_feature(feature: &str) -> bool {
36
    can_compile(&format!(
37
        "#![allow(stable_features)]\n#![feature({})]",
38
        feature
39
    ))
40
}
41
42
/// Test whether the rustc at `var("RUSTC")` can compile the given code.
43
fn can_compile<T: AsRef<str>>(test: T) -> bool {
44
    use std::process::Stdio;
45
36
    let out_dir = var("OUT_DIR").unwrap();
46
    let out_dir = var("OUT_DIR").unwrap();
37
    let rustc = var("RUSTC").unwrap();
47
    let rustc = var("RUSTC").unwrap();
38
    let target = var("TARGET").unwrap();
48
    let target = var("TARGET").unwrap();
39
49
40
    let mut child = std::process::Command::new(rustc)
50
    let mut cmd = if let Ok(wrapper) = var("CARGO_RUSTC_WRAPPER") {
41
        .arg("--crate-type=rlib") // Don't require `main`.
51
        let mut cmd = std::process::Command::new(wrapper);
52
        // The wrapper's first argument is supposed to be the path to rustc.
53
        cmd.arg(rustc);
54
        cmd
55
    } else {
56
        std::process::Command::new(rustc)
57
    };
58
59
    cmd.arg("--crate-type=rlib") // Don't require `main`.
42
        .arg("--emit=metadata") // Do as little as possible but still parse.
60
        .arg("--emit=metadata") // Do as little as possible but still parse.
43
        .arg("--target")
61
        .arg("--target")
44
        .arg(target)
62
        .arg(target)
45
        .arg("--out-dir")
63
        .arg("--out-dir")
46
        .arg(out_dir) // Put the output somewhere inconsequential.
64
        .arg(out_dir); // Put the output somewhere inconsequential.
65
66
    // If Cargo wants to set RUSTFLAGS, use that.
67
    if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {
68
        if !rustflags.is_empty() {
69
            for arg in rustflags.split('\x1f') {
70
                cmd.arg(arg);
71
            }
72
        }
73
    }
74
75
    let mut child = cmd
47
        .arg("-") // Read from stdin.
76
        .arg("-") // Read from stdin.
48
        .stdin(std::process::Stdio::piped()) // Stdin is a pipe.
77
        .stdin(Stdio::piped()) // Stdin is a pipe.
78
        .stderr(Stdio::null()) // Errors from feature detection aren't interesting and can be confusing.
49
        .spawn()
79
        .spawn()
50
        .unwrap();
80
        .unwrap();
51
81
52
    writeln!(child.stdin.take().unwrap(), "#![feature({})]", feature).unwrap();
82
    writeln!(child.stdin.take().unwrap(), "{}", test.as_ref()).unwrap();
53
83
54
    child.wait().unwrap().success()
84
    child.wait().unwrap().success()
55
}
85
}
56
86
57
/// Test whether the rustc at `var("RUSTC")` supports panic in `const fn`.
87
/// Test whether the rustc at `var("RUSTC")` supports panic in `const fn`.
58
fn has_panic_in_const_fn() -> bool {
88
fn has_panic_in_const_fn() -> bool {
59
    let out_dir = var("OUT_DIR").unwrap();
89
    can_compile("const fn foo() {{ panic!() }}")
60
    let rustc = var("RUSTC").unwrap();
61
    let target = var("TARGET").unwrap();
62
63
    let mut child = std::process::Command::new(rustc)
64
        .arg("--crate-type=rlib") // Don't require `main`.
65
        .arg("--emit=metadata") // Do as little as possible but still parse.
66
        .arg("--target")
67
        .arg(target)
68
        .arg("--out-dir")
69
        .arg(out_dir) // Put the output somewhere inconsequential.
70
        .arg("-") // Read from stdin.
71
        .stdin(std::process::Stdio::piped()) // Stdin is a pipe.
72
        .spawn()
73
        .unwrap();
74
75
    writeln!(child.stdin.take().unwrap(), "const fn foo() {{ panic!() }}").unwrap();
76
77
    child.wait().unwrap().success()
78
}
90
}
79
91
80
/// Test whether the rustc at `var("RUSTC")` supports the I/O safety feature.
92
/// Test whether the rustc at `var("RUSTC")` supports the I/O safety feature.
81
fn has_io_safety() -> bool {
93
fn has_io_safety() -> bool {
82
    let out_dir = var("OUT_DIR").unwrap();
94
    can_compile(
83
    let rustc = var("RUSTC").unwrap();
84
    let target = var("TARGET").unwrap();
85
86
    let mut child = std::process::Command::new(rustc)
87
        .arg("--crate-type=rlib") // Don't require `main`.
88
        .arg("--emit=metadata") // Do as little as possible but still parse.
89
        .arg("--target")
90
        .arg(target)
91
        .arg("--out-dir")
92
        .arg(out_dir) // Put the output somewhere inconsequential.
93
        .arg("-") // Read from stdin.
94
        .stdin(std::process::Stdio::piped()) // Stdin is a pipe.
95
        .spawn()
96
        .unwrap();
97
98
    writeln!(
99
        child.stdin.take().unwrap(),
100
        "\
95
        "\
101
    #[cfg(unix)]\n\
96
    #[cfg(unix)]\n\
102
    use std::os::unix::io::OwnedFd as Owned;\n\
97
    use std::os::unix::io::OwnedFd as Owned;\n\
Lines 106-114 fn has_io_safety() -> bool { Link Here
106
    use std::os::windows::io::OwnedHandle as Owned;\n\
101
    use std::os::windows::io::OwnedHandle as Owned;\n\
107
    \n\
102
    \n\
108
    pub type Success = Owned;\n\
103
    pub type Success = Owned;\n\
109
    "
104
    ",
110
    )
105
    )
111
    .unwrap();
112
113
    child.wait().unwrap().success()
114
}
106
}
(-)a/vendor/io-lifetimes/src/lib.rs (+2 lines)
Lines 30-35 Link Here
30
#![deny(missing_docs)]
30
#![deny(missing_docs)]
31
// Work around https://github.com/rust-lang/rust/issues/103306.
31
// Work around https://github.com/rust-lang/rust/issues/103306.
32
#![cfg_attr(all(wasi_ext, target_os = "wasi"), feature(wasi_ext))]
32
#![cfg_attr(all(wasi_ext, target_os = "wasi"), feature(wasi_ext))]
33
// Currently supported platforms.
34
#![cfg(any(unix, windows, target_os = "wasi"))]
33
35
34
mod portability;
36
mod portability;
35
mod traits;
37
mod traits;
(-)a/vendor/io-lifetimes-1.0.1/.cargo-checksum.json (-1 / +1 lines)
Line 1 Link Here
1
{"files":{"CODE_OF_CONDUCT.md":"e0bd80144c93b032dadb144d7cf8663c55d697ba2dd60382715c981dfc60e421","COPYRIGHT":"495c30b45120f8af07cfa26eb9cb1ebfe8324560dca2b3b1e76cad1b9b6b489a","Cargo.toml":"0c3d3968a0c2542eb050f842464f8d5c096844cee32e85e3e01a2a2665ee004a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"60c80ea4adbc7b64d49993a04a78626248a38f112f08d6f5411897ab965c34e8","build.rs":"39750efcc504bf0e96aa2bb3ffe3a7bfc806adaf7f8279186eaa61649a68903d","src/example_ffi.rs":"ab0e14396608f5f30cd6a2782413c8661d99ff6dc671eb83a5cf72b9e868d408","src/impls_async_std.rs":"62f73e42a2e76a9287f72f1c3db322114d4a08a2d8e2715c04156df60df1f876","src/impls_fs_err.rs":"12333298a291377a8c24835c60dfa3338e413e6435576cede04ce780da84ebe6","src/impls_mio.rs":"32ba71c1912d7dedcb110cb91dd953bab05a039d576c55a7508fcdad1bebbc2b","src/impls_os_pipe.rs":"5075498711f2dfdd6795d3afdb81bd3aca26c033d2f8f7238de59016d3ead0a9","src/impls_socket2.rs":"deacb4dd2c1e19ef483c937b6a18034397d729c3df361de5e748d70f5457f48b","src/impls_std.rs":"4e73f3993f539b7fa22db0b878eb8845d9ecf79f1580382619c83e18cf384fa3","src/impls_tokio.rs":"4f5f3dbdfa9395cd7e5149658cbd3872fa6c3973e1c844b7f6b48ee2e39e9197","src/lib.rs":"f2e4e26a26e44656ef4b18b06f42017b431dc20020c6572d0dec1887908a8b76","src/portability.rs":"3e9929c7c04524d99a481c646f708f29cd5e251bf44dad7115ae381c2bcaab78","src/raw.rs":"2fa1ea37da1cc993e36ce7950b3e2bc635b3ac268dacd5b5520e5bfc84741b4a","src/traits.rs":"8216c2a3436b9fb48345f4e0e88e1d7367de8609f8970b84e0c2126530cfad71","src/types.rs":"0985f60c8f5e6b1c4851d7b9edb51da48f917ee29501b90a71680aa340f24b85","src/views.rs":"ecc38c14b08566cc1667d530804a86124d90480e7fdecc585b0e4cfff7312807"},"package":"a7d367024b3f3414d8e01f437f704f41a9f64ab36f9067fa73e526ad4c763c87"}
1
{"files":{},"package":"a7d367024b3f3414d8e01f437f704f41a9f64ab36f9067fa73e526ad4c763c87"}
(-)a/vendor/io-lifetimes-1.0.1/README.md (-3 lines)
Lines 20-28 This is associated with [RFC 3128], the I/O Safety RFC, which is now merged. Link Here
20
Work is now underway to move the `OwnedFd` and `BorrowedFd` types and `AsFd`
20
Work is now underway to move the `OwnedFd` and `BorrowedFd` types and `AsFd`
21
trait developed here into `std`.
21
trait developed here into `std`.
22
22
23
Some features currently require nightly Rust, as they depend on `rustc_attrs`
24
to perform niche optimizations needed for FFI use cases.
25
26
For a quick taste, check out the code examples:
23
For a quick taste, check out the code examples:
27
24
28
 - [hello], a basic demo of this API, doing low-level I/O manually, using the
25
 - [hello], a basic demo of this API, doing low-level I/O manually, using the
(-)a/vendor/io-lifetimes-1.0.1/build.rs (-51 / +39 lines)
Lines 4-16 use std::io::Write; Link Here
4
fn main() {
4
fn main() {
5
    // I/O safety is stabilized in Rust 1.63.
5
    // I/O safety is stabilized in Rust 1.63.
6
    if has_io_safety() {
6
    if has_io_safety() {
7
        use_feature("io_lifetimes_use_std")
7
        use_feature("io_safety_is_in_std")
8
    }
8
    }
9
9
10
    // Niche optimizations for `Borrowed*` and `Owned*` depend on `rustc_attrs`
11
    // which, outside of `std`, are only available on nightly.
12
    use_feature_or_nothing("rustc_attrs");
13
14
    // Work around
10
    // Work around
15
    // https://github.com/rust-lang/rust/issues/103306.
11
    // https://github.com/rust-lang/rust/issues/103306.
16
    use_feature_or_nothing("wasi_ext");
12
    use_feature_or_nothing("wasi_ext");
Lines 37-106 fn use_feature(feature: &str) { Link Here
37
33
38
/// Test whether the rustc at `var("RUSTC")` supports the given feature.
34
/// Test whether the rustc at `var("RUSTC")` supports the given feature.
39
fn has_feature(feature: &str) -> bool {
35
fn has_feature(feature: &str) -> bool {
36
    can_compile(&format!(
37
        "#![allow(stable_features)]\n#![feature({})]",
38
        feature
39
    ))
40
}
41
42
/// Test whether the rustc at `var("RUSTC")` can compile the given code.
43
fn can_compile<T: AsRef<str>>(test: T) -> bool {
44
    use std::process::Stdio;
45
40
    let out_dir = var("OUT_DIR").unwrap();
46
    let out_dir = var("OUT_DIR").unwrap();
41
    let rustc = var("RUSTC").unwrap();
47
    let rustc = var("RUSTC").unwrap();
42
    let target = var("TARGET").unwrap();
48
    let target = var("TARGET").unwrap();
43
49
44
    let mut child = std::process::Command::new(rustc)
50
    let mut cmd = if let Ok(wrapper) = var("CARGO_RUSTC_WRAPPER") {
45
        .arg("--crate-type=rlib") // Don't require `main`.
51
        let mut cmd = std::process::Command::new(wrapper);
52
        // The wrapper's first argument is supposed to be the path to rustc.
53
        cmd.arg(rustc);
54
        cmd
55
    } else {
56
        std::process::Command::new(rustc)
57
    };
58
59
    cmd.arg("--crate-type=rlib") // Don't require `main`.
46
        .arg("--emit=metadata") // Do as little as possible but still parse.
60
        .arg("--emit=metadata") // Do as little as possible but still parse.
47
        .arg("--target")
61
        .arg("--target")
48
        .arg(target)
62
        .arg(target)
49
        .arg("--out-dir")
63
        .arg("--out-dir")
50
        .arg(out_dir) // Put the output somewhere inconsequential.
64
        .arg(out_dir); // Put the output somewhere inconsequential.
65
66
    // If Cargo wants to set RUSTFLAGS, use that.
67
    if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {
68
        if !rustflags.is_empty() {
69
            for arg in rustflags.split('\x1f') {
70
                cmd.arg(arg);
71
            }
72
        }
73
    }
74
75
    let mut child = cmd
51
        .arg("-") // Read from stdin.
76
        .arg("-") // Read from stdin.
52
        .stdin(std::process::Stdio::piped()) // Stdin is a pipe.
77
        .stdin(Stdio::piped()) // Stdin is a pipe.
78
        .stderr(Stdio::null()) // Errors from feature detection aren't interesting and can be confusing.
53
        .spawn()
79
        .spawn()
54
        .unwrap();
80
        .unwrap();
55
81
56
    writeln!(child.stdin.take().unwrap(), "#![feature({})]", feature).unwrap();
82
    writeln!(child.stdin.take().unwrap(), "{}", test.as_ref()).unwrap();
57
83
58
    child.wait().unwrap().success()
84
    child.wait().unwrap().success()
59
}
85
}
60
86
61
/// Test whether the rustc at `var("RUSTC")` supports panic in `const fn`.
87
/// Test whether the rustc at `var("RUSTC")` supports panic in `const fn`.
62
fn has_panic_in_const_fn() -> bool {
88
fn has_panic_in_const_fn() -> bool {
63
    let out_dir = var("OUT_DIR").unwrap();
89
    can_compile("const fn foo() {{ panic!() }}")
64
    let rustc = var("RUSTC").unwrap();
65
    let target = var("TARGET").unwrap();
66
67
    let mut child = std::process::Command::new(rustc)
68
        .arg("--crate-type=rlib") // Don't require `main`.
69
        .arg("--emit=metadata") // Do as little as possible but still parse.
70
        .arg("--target")
71
        .arg(target)
72
        .arg("--out-dir")
73
        .arg(out_dir) // Put the output somewhere inconsequential.
74
        .arg("-") // Read from stdin.
75
        .stdin(std::process::Stdio::piped()) // Stdin is a pipe.
76
        .spawn()
77
        .unwrap();
78
79
    writeln!(child.stdin.take().unwrap(), "const fn foo() {{ panic!() }}").unwrap();
80
81
    child.wait().unwrap().success()
82
}
90
}
83
91
84
/// Test whether the rustc at `var("RUSTC")` supports the I/O safety feature.
92
/// Test whether the rustc at `var("RUSTC")` supports the I/O safety feature.
85
fn has_io_safety() -> bool {
93
fn has_io_safety() -> bool {
86
    let out_dir = var("OUT_DIR").unwrap();
94
    can_compile(
87
    let rustc = var("RUSTC").unwrap();
88
    let target = var("TARGET").unwrap();
89
90
    let mut child = std::process::Command::new(rustc)
91
        .arg("--crate-type=rlib") // Don't require `main`.
92
        .arg("--emit=metadata") // Do as little as possible but still parse.
93
        .arg("--target")
94
        .arg(target)
95
        .arg("--out-dir")
96
        .arg(out_dir) // Put the output somewhere inconsequential.
97
        .arg("-") // Read from stdin.
98
        .stdin(std::process::Stdio::piped()) // Stdin is a pipe.
99
        .spawn()
100
        .unwrap();
101
102
    writeln!(
103
        child.stdin.take().unwrap(),
104
        "\
95
        "\
105
    #[cfg(unix)]\n\
96
    #[cfg(unix)]\n\
106
    use std::os::unix::io::OwnedFd as Owned;\n\
97
    use std::os::unix::io::OwnedFd as Owned;\n\
Lines 110-118 fn has_io_safety() -> bool { Link Here
110
    use std::os::windows::io::OwnedHandle as Owned;\n\
101
    use std::os::windows::io::OwnedHandle as Owned;\n\
111
    \n\
102
    \n\
112
    pub type Success = Owned;\n\
103
    pub type Success = Owned;\n\
113
    "
104
    ",
114
    )
105
    )
115
    .unwrap();
116
117
    child.wait().unwrap().success()
118
}
106
}
(-)a/vendor/io-lifetimes-1.0.1/src/example_ffi.rs (-2 / +2 lines)
Lines 1-6 Link Here
1
//! This is just a sample of what FFI using this crate can look like.
1
//! This is just a sample of what FFI using this crate can look like.
2
2
3
#![cfg_attr(not(rustc_attrs), allow(unused_imports))]
3
#![cfg_attr(not(io_safety_is_in_std), allow(unused_imports))]
4
#![allow(missing_docs)]
4
#![allow(missing_docs)]
5
5
6
#[cfg(any(unix, target_os = "wasi"))]
6
#[cfg(any(unix, target_os = "wasi"))]
Lines 23-29 use { Link Here
23
};
23
};
24
24
25
// Declare a few FFI functions ourselves, to show off the FFI ergonomics.
25
// Declare a few FFI functions ourselves, to show off the FFI ergonomics.
26
#[cfg(all(rustc_attrs, any(unix, target_os = "wasi")))]
26
#[cfg(all(io_safety_is_in_std, any(unix, target_os = "wasi")))]
27
extern "C" {
27
extern "C" {
28
    pub fn open(pathname: *const c_char, flags: c_int, ...) -> Option<OwnedFd>;
28
    pub fn open(pathname: *const c_char, flags: c_int, ...) -> Option<OwnedFd>;
29
}
29
}
(-)a/vendor/io-lifetimes-1.0.1/src/lib.rs (-22 / +23 lines)
Lines 28-49 Link Here
28
//! [from+into conversions]: FromFilelike::from_into_filelike
28
//! [from+into conversions]: FromFilelike::from_into_filelike
29
29
30
#![deny(missing_docs)]
30
#![deny(missing_docs)]
31
#![cfg_attr(rustc_attrs, feature(rustc_attrs))]
32
// Work around https://github.com/rust-lang/rust/issues/103306.
31
// Work around https://github.com/rust-lang/rust/issues/103306.
33
#![cfg_attr(all(wasi_ext, target_os = "wasi"), feature(wasi_ext))]
32
#![cfg_attr(all(wasi_ext, target_os = "wasi"), feature(wasi_ext))]
33
// Currently supported platforms.
34
#![cfg(any(unix, windows, target_os = "wasi"))]
34
35
35
mod portability;
36
mod portability;
36
mod traits;
37
mod traits;
37
#[cfg(not(io_lifetimes_use_std))]
38
#[cfg(not(io_safety_is_in_std))]
38
mod types;
39
mod types;
39
40
40
#[cfg(not(io_lifetimes_use_std))]
41
#[cfg(not(io_safety_is_in_std))]
41
mod impls_std;
42
mod impls_std;
42
43
43
#[cfg(not(io_lifetimes_use_std))]
44
#[cfg(not(io_safety_is_in_std))]
44
#[cfg(any(unix, target_os = "wasi"))]
45
#[cfg(any(unix, target_os = "wasi"))]
45
pub use traits::AsFd;
46
pub use traits::AsFd;
46
#[cfg(not(io_lifetimes_use_std))]
47
#[cfg(not(io_safety_is_in_std))]
47
#[cfg(windows)]
48
#[cfg(windows)]
48
pub use traits::{AsHandle, AsSocket};
49
pub use traits::{AsHandle, AsSocket};
49
#[cfg(any(unix, target_os = "wasi"))]
50
#[cfg(any(unix, target_os = "wasi"))]
Lines 53-75 pub use traits::{FromFd, IntoFd}; Link Here
53
#[allow(deprecated)]
54
#[allow(deprecated)]
54
pub use traits::{FromHandle, FromSocket, IntoHandle, IntoSocket};
55
pub use traits::{FromHandle, FromSocket, IntoHandle, IntoSocket};
55
56
56
#[cfg(not(io_lifetimes_use_std))]
57
#[cfg(not(io_safety_is_in_std))]
57
#[cfg(any(unix, target_os = "wasi"))]
58
#[cfg(any(unix, target_os = "wasi"))]
58
pub use types::{BorrowedFd, OwnedFd};
59
pub use types::{BorrowedFd, OwnedFd};
59
#[cfg(not(io_lifetimes_use_std))]
60
#[cfg(not(io_safety_is_in_std))]
60
#[cfg(windows)]
61
#[cfg(windows)]
61
pub use types::{
62
pub use types::{
62
    BorrowedHandle, BorrowedSocket, HandleOrInvalid, InvalidHandleError, NullHandleError,
63
    BorrowedHandle, BorrowedSocket, HandleOrInvalid, InvalidHandleError, NullHandleError,
63
    OwnedHandle, OwnedSocket,
64
    OwnedHandle, OwnedSocket,
64
};
65
};
65
66
66
#[cfg(io_lifetimes_use_std)]
67
#[cfg(io_safety_is_in_std)]
67
#[cfg(unix)]
68
#[cfg(unix)]
68
pub use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd};
69
pub use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd};
69
#[cfg(io_lifetimes_use_std)]
70
#[cfg(io_safety_is_in_std)]
70
#[cfg(target_os = "wasi")]
71
#[cfg(target_os = "wasi")]
71
pub use std::os::wasi::io::{AsFd, BorrowedFd, OwnedFd};
72
pub use std::os::wasi::io::{AsFd, BorrowedFd, OwnedFd};
72
#[cfg(io_lifetimes_use_std)]
73
#[cfg(io_safety_is_in_std)]
73
#[cfg(windows)]
74
#[cfg(windows)]
74
pub use std::os::windows::io::{
75
pub use std::os::windows::io::{
75
    AsHandle, AsSocket, BorrowedHandle, BorrowedSocket, HandleOrInvalid, InvalidHandleError,
76
    AsHandle, AsSocket, BorrowedHandle, BorrowedSocket, HandleOrInvalid, InvalidHandleError,
Lines 87-93 pub use std::os::windows::io::{ Link Here
87
//
88
//
88
// So we define `FromFd`/`IntoFd` traits, and implement them in terms of
89
// So we define `FromFd`/`IntoFd` traits, and implement them in terms of
89
// `From`/`Into`,
90
// `From`/`Into`,
90
#[cfg(io_lifetimes_use_std)]
91
#[cfg(io_safety_is_in_std)]
91
#[cfg(any(unix, target_os = "wasi"))]
92
#[cfg(any(unix, target_os = "wasi"))]
92
#[allow(deprecated)]
93
#[allow(deprecated)]
93
impl<T: From<OwnedFd>> FromFd for T {
94
impl<T: From<OwnedFd>> FromFd for T {
Lines 96-102 impl<T: From<OwnedFd>> FromFd for T { Link Here
96
        owned_fd.into()
97
        owned_fd.into()
97
    }
98
    }
98
}
99
}
99
#[cfg(io_lifetimes_use_std)]
100
#[cfg(io_safety_is_in_std)]
100
#[cfg(any(unix, target_os = "wasi"))]
101
#[cfg(any(unix, target_os = "wasi"))]
101
#[allow(deprecated)]
102
#[allow(deprecated)]
102
impl<T> IntoFd for T
103
impl<T> IntoFd for T
Lines 109-115 where Link Here
109
    }
110
    }
110
}
111
}
111
112
112
#[cfg(io_lifetimes_use_std)]
113
#[cfg(io_safety_is_in_std)]
113
#[cfg(windows)]
114
#[cfg(windows)]
114
#[allow(deprecated)]
115
#[allow(deprecated)]
115
impl<T: From<OwnedHandle>> FromHandle for T {
116
impl<T: From<OwnedHandle>> FromHandle for T {
Lines 118-124 impl<T: From<OwnedHandle>> FromHandle for T { Link Here
118
        owned_handle.into()
119
        owned_handle.into()
119
    }
120
    }
120
}
121
}
121
#[cfg(io_lifetimes_use_std)]
122
#[cfg(io_safety_is_in_std)]
122
#[cfg(windows)]
123
#[cfg(windows)]
123
#[allow(deprecated)]
124
#[allow(deprecated)]
124
impl<T> IntoHandle for T
125
impl<T> IntoHandle for T
Lines 131-137 where Link Here
131
    }
132
    }
132
}
133
}
133
134
134
#[cfg(io_lifetimes_use_std)]
135
#[cfg(io_safety_is_in_std)]
135
#[cfg(windows)]
136
#[cfg(windows)]
136
#[allow(deprecated)]
137
#[allow(deprecated)]
137
impl<T: From<OwnedSocket>> FromSocket for T {
138
impl<T: From<OwnedSocket>> FromSocket for T {
Lines 140-146 impl<T: From<OwnedSocket>> FromSocket for T { Link Here
140
        owned_socket.into()
141
        owned_socket.into()
141
    }
142
    }
142
}
143
}
143
#[cfg(io_lifetimes_use_std)]
144
#[cfg(io_safety_is_in_std)]
144
#[cfg(windows)]
145
#[cfg(windows)]
145
#[allow(deprecated)]
146
#[allow(deprecated)]
146
impl<T> IntoSocket for T
147
impl<T> IntoSocket for T
Lines 165-186 pub mod views; Link Here
165
166
166
// Ideally, we'd want crates to implement our traits themselves. But for now,
167
// Ideally, we'd want crates to implement our traits themselves. But for now,
167
// while we're prototyping, we provide a few impls on foreign types.
168
// while we're prototyping, we provide a few impls on foreign types.
168
#[cfg(not(io_lifetimes_use_std))]
169
#[cfg(not(io_safety_is_in_std))]
169
#[cfg(feature = "async-std")]
170
#[cfg(feature = "async-std")]
170
mod impls_async_std;
171
mod impls_async_std;
171
#[cfg(not(io_lifetimes_use_std))]
172
#[cfg(not(io_safety_is_in_std))]
172
#[cfg(feature = "fs-err")]
173
#[cfg(feature = "fs-err")]
173
mod impls_fs_err;
174
mod impls_fs_err;
174
#[cfg(not(io_lifetimes_use_std))]
175
#[cfg(not(io_safety_is_in_std))]
175
#[cfg(feature = "mio")]
176
#[cfg(feature = "mio")]
176
mod impls_mio;
177
mod impls_mio;
177
#[cfg(not(target_os = "wasi"))]
178
#[cfg(not(target_os = "wasi"))]
178
#[cfg(not(io_lifetimes_use_std))]
179
#[cfg(not(io_safety_is_in_std))]
179
#[cfg(feature = "os_pipe")]
180
#[cfg(feature = "os_pipe")]
180
mod impls_os_pipe;
181
mod impls_os_pipe;
181
#[cfg(not(io_lifetimes_use_std))]
182
#[cfg(not(io_safety_is_in_std))]
182
#[cfg(feature = "socket2")]
183
#[cfg(feature = "socket2")]
183
mod impls_socket2;
184
mod impls_socket2;
184
#[cfg(not(io_lifetimes_use_std))]
185
#[cfg(not(io_safety_is_in_std))]
185
#[cfg(feature = "tokio")]
186
#[cfg(feature = "tokio")]
186
mod impls_tokio;
187
mod impls_tokio;
(-)a/vendor/io-lifetimes-1.0.1/src/traits.rs (-11 / +11 lines)
Lines 1-9 Link Here
1
#[cfg(not(io_lifetimes_use_std))]
1
#[cfg(not(io_safety_is_in_std))]
2
#[cfg(any(unix, target_os = "wasi"))]
2
#[cfg(any(unix, target_os = "wasi"))]
3
use crate::BorrowedFd;
3
use crate::BorrowedFd;
4
#[cfg(any(unix, target_os = "wasi"))]
4
#[cfg(any(unix, target_os = "wasi"))]
5
use crate::OwnedFd;
5
use crate::OwnedFd;
6
#[cfg(not(io_lifetimes_use_std))]
6
#[cfg(not(io_safety_is_in_std))]
7
#[cfg(windows)]
7
#[cfg(windows)]
8
use crate::{BorrowedHandle, BorrowedSocket};
8
use crate::{BorrowedHandle, BorrowedSocket};
9
#[cfg(windows)]
9
#[cfg(windows)]
Lines 14-20 use crate::{OwnedHandle, OwnedSocket}; Link Here
14
/// This is only available on unix platforms and must be imported in order to
14
/// This is only available on unix platforms and must be imported in order to
15
/// call the method. Windows platforms have a corresponding `AsHandle` and
15
/// call the method. Windows platforms have a corresponding `AsHandle` and
16
/// `AsSocket` set of traits.
16
/// `AsSocket` set of traits.
17
#[cfg(not(io_lifetimes_use_std))]
17
#[cfg(not(io_safety_is_in_std))]
18
#[cfg(any(unix, target_os = "wasi"))]
18
#[cfg(any(unix, target_os = "wasi"))]
19
pub trait AsFd {
19
pub trait AsFd {
20
    /// Borrows the file descriptor.
20
    /// Borrows the file descriptor.
Lines 34-40 pub trait AsFd { Link Here
34
}
34
}
35
35
36
/// A trait to borrow the handle from an underlying object.
36
/// A trait to borrow the handle from an underlying object.
37
#[cfg(not(io_lifetimes_use_std))]
37
#[cfg(not(io_safety_is_in_std))]
38
#[cfg(windows)]
38
#[cfg(windows)]
39
pub trait AsHandle {
39
pub trait AsHandle {
40
    /// Borrows the handle.
40
    /// Borrows the handle.
Lines 54-60 pub trait AsHandle { Link Here
54
}
54
}
55
55
56
/// A trait to borrow the socket from an underlying object.
56
/// A trait to borrow the socket from an underlying object.
57
#[cfg(not(io_lifetimes_use_std))]
57
#[cfg(not(io_safety_is_in_std))]
58
#[cfg(windows)]
58
#[cfg(windows)]
59
pub trait AsSocket {
59
pub trait AsSocket {
60
    /// Borrows the socket.
60
    /// Borrows the socket.
Lines 235-241 pub trait FromSocket { Link Here
235
    }
235
    }
236
}
236
}
237
237
238
#[cfg(not(io_lifetimes_use_std))]
238
#[cfg(not(io_safety_is_in_std))]
239
#[cfg(any(unix, target_os = "wasi"))]
239
#[cfg(any(unix, target_os = "wasi"))]
240
impl<T: AsFd> AsFd for &T {
240
impl<T: AsFd> AsFd for &T {
241
    #[inline]
241
    #[inline]
Lines 244-250 impl<T: AsFd> AsFd for &T { Link Here
244
    }
244
    }
245
}
245
}
246
246
247
#[cfg(not(io_lifetimes_use_std))]
247
#[cfg(not(io_safety_is_in_std))]
248
#[cfg(any(unix, target_os = "wasi"))]
248
#[cfg(any(unix, target_os = "wasi"))]
249
impl<T: AsFd> AsFd for &mut T {
249
impl<T: AsFd> AsFd for &mut T {
250
    #[inline]
250
    #[inline]
Lines 253-259 impl<T: AsFd> AsFd for &mut T { Link Here
253
    }
253
    }
254
}
254
}
255
255
256
#[cfg(not(io_lifetimes_use_std))]
256
#[cfg(not(io_safety_is_in_std))]
257
#[cfg(windows)]
257
#[cfg(windows)]
258
impl<T: AsHandle> AsHandle for &T {
258
impl<T: AsHandle> AsHandle for &T {
259
    #[inline]
259
    #[inline]
Lines 262-268 impl<T: AsHandle> AsHandle for &T { Link Here
262
    }
262
    }
263
}
263
}
264
264
265
#[cfg(not(io_lifetimes_use_std))]
265
#[cfg(not(io_safety_is_in_std))]
266
#[cfg(windows)]
266
#[cfg(windows)]
267
impl<T: AsHandle> AsHandle for &mut T {
267
impl<T: AsHandle> AsHandle for &mut T {
268
    #[inline]
268
    #[inline]
Lines 271-277 impl<T: AsHandle> AsHandle for &mut T { Link Here
271
    }
271
    }
272
}
272
}
273
273
274
#[cfg(not(io_lifetimes_use_std))]
274
#[cfg(not(io_safety_is_in_std))]
275
#[cfg(windows)]
275
#[cfg(windows)]
276
impl<T: AsSocket> AsSocket for &T {
276
impl<T: AsSocket> AsSocket for &T {
277
    #[inline]
277
    #[inline]
Lines 280-286 impl<T: AsSocket> AsSocket for &T { Link Here
280
    }
280
    }
281
}
281
}
282
282
283
#[cfg(not(io_lifetimes_use_std))]
283
#[cfg(not(io_safety_is_in_std))]
284
#[cfg(windows)]
284
#[cfg(windows)]
285
impl<T: AsSocket> AsSocket for &mut T {
285
impl<T: AsSocket> AsSocket for &mut T {
286
    #[inline]
286
    #[inline]
(-)a/vendor/io-lifetimes-1.0.1/src/types.rs (-34 lines)
Lines 50-61 const INVALID_SOCKET: usize = !0 as _; Link Here
50
#[cfg(any(unix, target_os = "wasi"))]
50
#[cfg(any(unix, target_os = "wasi"))]
51
#[derive(Copy, Clone)]
51
#[derive(Copy, Clone)]
52
#[repr(transparent)]
52
#[repr(transparent)]
53
#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
54
#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
55
// libstd/os/raw/mod.rs assures me that every libstd-supported platform has a
56
// 32-bit c_int. Below is -2, in two's complement, but that only works out
57
// because c_int is 32 bits.
58
#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE))]
59
pub struct BorrowedFd<'fd> {
53
pub struct BorrowedFd<'fd> {
60
    fd: RawFd,
54
    fd: RawFd,
61
    _phantom: PhantomData<&'fd OwnedFd>,
55
    _phantom: PhantomData<&'fd OwnedFd>,
Lines 105-121 pub struct BorrowedHandle<'handle> { Link Here
105
#[cfg(windows)]
99
#[cfg(windows)]
106
#[derive(Copy, Clone)]
100
#[derive(Copy, Clone)]
107
#[repr(transparent)]
101
#[repr(transparent)]
108
#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
109
#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
110
// This is -2, in two's complement. -1 is `INVALID_SOCKET`.
111
#[cfg_attr(
112
    all(rustc_attrs, target_pointer_width = "32"),
113
    rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)
114
)]
115
#[cfg_attr(
116
    all(rustc_attrs, target_pointer_width = "64"),
117
    rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FF_FF_FF_FF_FE)
118
)]
119
pub struct BorrowedSocket<'socket> {
102
pub struct BorrowedSocket<'socket> {
120
    socket: RawSocket,
103
    socket: RawSocket,
121
    _phantom: PhantomData<&'socket OwnedSocket>,
104
    _phantom: PhantomData<&'socket OwnedSocket>,
Lines 131-142 pub struct BorrowedSocket<'socket> { Link Here
131
/// has the value `-1`.
114
/// has the value `-1`.
132
#[cfg(any(unix, target_os = "wasi"))]
115
#[cfg(any(unix, target_os = "wasi"))]
133
#[repr(transparent)]
116
#[repr(transparent)]
134
#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
135
#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
136
// libstd/os/raw/mod.rs assures me that every libstd-supported platform has a
137
// 32-bit c_int. Below is -2, in two's complement, but that only works out
138
// because c_int is 32 bits.
139
#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE))]
140
pub struct OwnedFd {
117
pub struct OwnedFd {
141
    fd: RawFd,
118
    fd: RawFd,
142
}
119
}
Lines 286-302 impl BorrowedHandle<'_> { Link Here
286
/// [`INVALID_SOCKET`].
263
/// [`INVALID_SOCKET`].
287
#[cfg(windows)]
264
#[cfg(windows)]
288
#[repr(transparent)]
265
#[repr(transparent)]
289
#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
290
#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
291
// This is -2, in two's complement. -1 is `INVALID_SOCKET`.
292
#[cfg_attr(
293
    all(rustc_attrs, target_pointer_width = "32"),
294
    rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)
295
)]
296
#[cfg_attr(
297
    all(rustc_attrs, target_pointer_width = "64"),
298
    rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FF_FF_FF_FF_FE)
299
)]
300
pub struct OwnedSocket {
266
pub struct OwnedSocket {
301
    socket: RawSocket,
267
    socket: RawSocket,
302
}
268
}

Return to bug 893996