summaryrefslogtreecommitdiffstats
path: root/vendor/io-lifetimes
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
commit4547b622d8d29df964fa2914213088b148c498fc (patch)
tree9fc6b25f3c3add6b745be9a2400a6e96140046e9 /vendor/io-lifetimes
parentReleasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz
rustc-4547b622d8d29df964fa2914213088b148c498fc.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/io-lifetimes')
-rw-r--r--vendor/io-lifetimes/.cargo-checksum.json2
-rw-r--r--vendor/io-lifetimes/Cargo.lock681
-rw-r--r--vendor/io-lifetimes/Cargo.toml52
-rw-r--r--vendor/io-lifetimes/README.md45
-rw-r--r--vendor/io-lifetimes/build.rs53
-rw-r--r--vendor/io-lifetimes/examples/easy-conversions.rs30
-rw-r--r--vendor/io-lifetimes/examples/flexible-apis.rs108
-rw-r--r--vendor/io-lifetimes/examples/hello.rs129
-rw-r--r--vendor/io-lifetimes/examples/owning-wrapper.rs147
-rw-r--r--vendor/io-lifetimes/examples/portable-views.rs28
-rw-r--r--vendor/io-lifetimes/src/example_ffi.rs4
-rw-r--r--vendor/io-lifetimes/src/impls_async_std.rs16
-rw-r--r--vendor/io-lifetimes/src/impls_mio.rs24
-rw-r--r--vendor/io-lifetimes/src/impls_os_pipe.rs5
-rw-r--r--vendor/io-lifetimes/src/impls_socket2.rs3
-rw-r--r--vendor/io-lifetimes/src/impls_std.rs2
-rw-r--r--vendor/io-lifetimes/src/impls_std_views.rs31
-rw-r--r--vendor/io-lifetimes/src/lib.rs56
-rw-r--r--vendor/io-lifetimes/src/portability.rs93
-rw-r--r--vendor/io-lifetimes/src/traits.rs72
-rw-r--r--vendor/io-lifetimes/src/types.rs34
-rw-r--r--vendor/io-lifetimes/src/views.rs73
-rw-r--r--vendor/io-lifetimes/tests/api.rs146
-rw-r--r--vendor/io-lifetimes/tests/assumptions.rs45
-rw-r--r--vendor/io-lifetimes/tests/ffi.rs80
-rw-r--r--vendor/io-lifetimes/tests/niche-optimizations.rs71
26 files changed, 295 insertions, 1735 deletions
diff --git a/vendor/io-lifetimes/.cargo-checksum.json b/vendor/io-lifetimes/.cargo-checksum.json
index 08c6f8ebe..4b5ed4f4a 100644
--- a/vendor/io-lifetimes/.cargo-checksum.json
+++ b/vendor/io-lifetimes/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CODE_OF_CONDUCT.md":"e0bd80144c93b032dadb144d7cf8663c55d697ba2dd60382715c981dfc60e421","COPYRIGHT":"495c30b45120f8af07cfa26eb9cb1ebfe8324560dca2b3b1e76cad1b9b6b489a","Cargo.lock":"dd6a376632f836832953169417d45b477b5050b1e5485830cce175adb68a3358","Cargo.toml":"ec54c49715f8b315addcf954402f37ada2da0a551d247cd9a2789cf7088f9b05","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"3d07d8badedf6aa11fa8823658c178513ca4c3526328a31491ae1039bfcc0ed1","build.rs":"6b84b29203d9fb618900897dab3a3046967859146c3ec6f8c6ecdd2f6f3a35e7","examples/easy-conversions.rs":"d79a4c39740b842d546f76bfe94a905453730e1c47085d833c21e3903b7874f0","examples/flexible-apis.rs":"c6c9694aa124840e88ca4cb916797f639ac3d35d506f9d7dbc22e44fdbbffe91","examples/hello.rs":"9af2076eefb23e609e9766888404f8b6932ff349ae915617d8e1cfdde3db8b4f","examples/owning-wrapper.rs":"eb03f12c925a15b89aa809c4afaa1fa07ddbaedf09cb8e901e7c2cb5cea9eb00","examples/portable-views.rs":"ff8a9b8391eec5c864dc4fc5f0c80d62d178632f4deb2258ac1188a3a3b2825d","src/example_ffi.rs":"ab0e14396608f5f30cd6a2782413c8661d99ff6dc671eb83a5cf72b9e868d408","src/impls_async_std.rs":"f364a2b6195940723759392d22fd33574c3984f9e7685ef2f36db416ac15a1d6","src/impls_fs_err.rs":"12333298a291377a8c24835c60dfa3338e413e6435576cede04ce780da84ebe6","src/impls_mio.rs":"4defa07ff15012a97f38f373e9a241641c1a0c3db674a3136eca9dd5a50ca54a","src/impls_os_pipe.rs":"96632e7eda41ee2e7fa6cb46b736c10bc671f82716e7b6135286ee224ec5fa31","src/impls_socket2.rs":"2bd87222821955bce8b5c05b438080c0c79a2b69f7f42e0ca41786db3e86c6ef","src/impls_std.rs":"f1c2ebe5c259c3c8ac84b14c62ad63b50fa9f7150417a30cc9b4f1fafa598278","src/impls_std_views.rs":"f6e8737a08e85a9b3be85d606f45221dcc19b5b842b857ab4d6a1e023f453c27","src/impls_tokio.rs":"4f5f3dbdfa9395cd7e5149658cbd3872fa6c3973e1c844b7f6b48ee2e39e9197","src/lib.rs":"1995f551c7ea0535df72ee101ad3887503b92fb99b56b489a37c9f95cdc82685","src/portability.rs":"836b7612cb98a79dfb244d3034e4746b29d0505aac1583ee38da373c8e29f8b3","src/raw.rs":"2fa1ea37da1cc993e36ce7950b3e2bc635b3ac268dacd5b5520e5bfc84741b4a","src/traits.rs":"058dad18da48aba538cf90dd5c93c167b18c53e43423d45028a995380f64c7d1","src/types.rs":"0985f60c8f5e6b1c4851d7b9edb51da48f917ee29501b90a71680aa340f24b85","src/views.rs":"f6eba3976be724ede0fd4e45fed7fae5025e24ced7057955f1e6cf9ce356e116","tests/api.rs":"e04858bd882757a0fc1fd96bea22a3315bb405cf8277dc7e24ff05d93d93fcfd","tests/assumptions.rs":"a743186097cc5715feffad31989f3c115ae59c8e2021ef8fd61298597185731c","tests/ffi.rs":"50817d2a83f69696ecdddcd1eb38a8c9f76dc40b6e324a7c95ebc7f89d1dda8c","tests/niche-optimizations.rs":"bcbdb957e708a1ca475d423c93ca444b9cc8cba432b28da7be094d432110e8c2"},"package":"24c3f4eff5495aee4c0399d7b6a0dc2b6e81be84242ffbfcf253ebacccc1d0cb"} \ No newline at end of file
+{"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"} \ No newline at end of file
diff --git a/vendor/io-lifetimes/Cargo.lock b/vendor/io-lifetimes/Cargo.lock
deleted file mode 100644
index a58b37b90..000000000
--- a/vendor/io-lifetimes/Cargo.lock
+++ /dev/null
@@ -1,681 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "async-channel"
-version = "1.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
-dependencies = [
- "concurrent-queue",
- "event-listener",
- "futures-core",
-]
-
-[[package]]
-name = "async-executor"
-version = "1.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965"
-dependencies = [
- "async-task",
- "concurrent-queue",
- "fastrand",
- "futures-lite",
- "once_cell",
- "slab",
-]
-
-[[package]]
-name = "async-global-executor"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd8b508d585e01084059b60f06ade4cb7415cd2e4084b71dd1cb44e7d3fb9880"
-dependencies = [
- "async-channel",
- "async-executor",
- "async-io",
- "async-lock",
- "blocking",
- "futures-lite",
- "once_cell",
-]
-
-[[package]]
-name = "async-io"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07"
-dependencies = [
- "concurrent-queue",
- "futures-lite",
- "libc",
- "log",
- "once_cell",
- "parking",
- "polling",
- "slab",
- "socket2",
- "waker-fn",
- "winapi",
-]
-
-[[package]]
-name = "async-lock"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6"
-dependencies = [
- "event-listener",
-]
-
-[[package]]
-name = "async-process"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c"
-dependencies = [
- "async-io",
- "blocking",
- "cfg-if",
- "event-listener",
- "futures-lite",
- "libc",
- "once_cell",
- "signal-hook",
- "winapi",
-]
-
-[[package]]
-name = "async-std"
-version = "1.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c"
-dependencies = [
- "async-channel",
- "async-global-executor",
- "async-io",
- "async-lock",
- "async-process",
- "crossbeam-utils",
- "futures-channel",
- "futures-core",
- "futures-io",
- "futures-lite",
- "gloo-timers",
- "kv-log-macro",
- "log",
- "memchr",
- "num_cpus",
- "once_cell",
- "pin-project-lite",
- "pin-utils",
- "slab",
- "wasm-bindgen-futures",
-]
-
-[[package]]
-name = "async-task"
-version = "4.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9"
-
-[[package]]
-name = "atomic-waker"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
-
-[[package]]
-name = "blocking"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc"
-dependencies = [
- "async-channel",
- "async-task",
- "atomic-waker",
- "fastrand",
- "futures-lite",
- "once_cell",
-]
-
-[[package]]
-name = "bumpalo"
-version = "3.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
-
-[[package]]
-name = "bytes"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
-
-[[package]]
-name = "cache-padded"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
-
-[[package]]
-name = "cc"
-version = "1.0.73"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-
-[[package]]
-name = "concurrent-queue"
-version = "1.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
-dependencies = [
- "cache-padded",
-]
-
-[[package]]
-name = "crossbeam-utils"
-version = "0.8.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
-dependencies = [
- "cfg-if",
- "lazy_static",
-]
-
-[[package]]
-name = "ctor"
-version = "0.1.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c"
-dependencies = [
- "quote",
- "syn",
-]
-
-[[package]]
-name = "event-listener"
-version = "2.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
-
-[[package]]
-name = "fastrand"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
-dependencies = [
- "instant",
-]
-
-[[package]]
-name = "fs-err"
-version = "2.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bd79fa345a495d3ae89fb7165fec01c0e72f41821d642dda363a1e97975652e"
-
-[[package]]
-name = "futures-channel"
-version = "0.3.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010"
-dependencies = [
- "futures-core",
-]
-
-[[package]]
-name = "futures-core"
-version = "0.3.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
-
-[[package]]
-name = "futures-io"
-version = "0.3.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
-
-[[package]]
-name = "futures-lite"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
-dependencies = [
- "fastrand",
- "futures-core",
- "futures-io",
- "memchr",
- "parking",
- "pin-project-lite",
- "waker-fn",
-]
-
-[[package]]
-name = "gloo-timers"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9"
-dependencies = [
- "futures-channel",
- "futures-core",
- "js-sys",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "hermit-abi"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "instant"
-version = "0.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "io-lifetimes"
-version = "0.7.2"
-dependencies = [
- "async-std",
- "fs-err",
- "libc",
- "mio",
- "os_pipe",
- "socket2",
- "tokio",
- "windows-sys",
-]
-
-[[package]]
-name = "js-sys"
-version = "0.3.57"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397"
-dependencies = [
- "wasm-bindgen",
-]
-
-[[package]]
-name = "kv-log-macro"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
-dependencies = [
- "log",
-]
-
-[[package]]
-name = "lazy_static"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-
-[[package]]
-name = "libc"
-version = "0.2.126"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
-
-[[package]]
-name = "log"
-version = "0.4.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
-dependencies = [
- "cfg-if",
- "value-bag",
-]
-
-[[package]]
-name = "memchr"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
-
-[[package]]
-name = "mio"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799"
-dependencies = [
- "libc",
- "log",
- "wasi",
- "windows-sys",
-]
-
-[[package]]
-name = "num_cpus"
-version = "1.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
-dependencies = [
- "hermit-abi",
- "libc",
-]
-
-[[package]]
-name = "once_cell"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
-
-[[package]]
-name = "os_pipe"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c92f2b54f081d635c77e7120862d48db8e91f7f21cef23ab1b4fe9971c59f55"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "parking"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
-
-[[package]]
-name = "pin-project-lite"
-version = "0.2.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
-
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-
-[[package]]
-name = "polling"
-version = "2.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259"
-dependencies = [
- "cfg-if",
- "libc",
- "log",
- "wepoll-ffi",
- "winapi",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.39"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
-dependencies = [
- "unicode-ident",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "signal-hook"
-version = "0.3.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"
-dependencies = [
- "libc",
- "signal-hook-registry",
-]
-
-[[package]]
-name = "signal-hook-registry"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "slab"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
-
-[[package]]
-name = "socket2"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "syn"
-version = "1.0.96"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "tokio"
-version = "1.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f392c8f16bda3456c0b00c6de39cb100449b98de55ac41c6cdd2bfcf53a1245"
-dependencies = [
- "bytes",
- "libc",
- "mio",
- "once_cell",
- "pin-project-lite",
- "signal-hook-registry",
- "socket2",
- "winapi",
-]
-
-[[package]]
-name = "unicode-ident"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
-
-[[package]]
-name = "value-bag"
-version = "1.0.0-alpha.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55"
-dependencies = [
- "ctor",
- "version_check",
-]
-
-[[package]]
-name = "version_check"
-version = "0.9.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
-
-[[package]]
-name = "waker-fn"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
-
-[[package]]
-name = "wasi"
-version = "0.11.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
-
-[[package]]
-name = "wasm-bindgen"
-version = "0.2.80"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad"
-dependencies = [
- "cfg-if",
- "wasm-bindgen-macro",
-]
-
-[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.80"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4"
-dependencies = [
- "bumpalo",
- "lazy_static",
- "log",
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-futures"
-version = "0.4.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2"
-dependencies = [
- "cfg-if",
- "js-sys",
- "wasm-bindgen",
- "web-sys",
-]
-
-[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.80"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
-
-[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.80"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.80"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744"
-
-[[package]]
-name = "web-sys"
-version = "0.3.57"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "wepoll-ffi"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
-dependencies = [
- "cc",
-]
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
-[[package]]
-name = "windows-sys"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
-dependencies = [
- "windows_aarch64_msvc",
- "windows_i686_gnu",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_msvc",
-]
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
-
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
diff --git a/vendor/io-lifetimes/Cargo.toml b/vendor/io-lifetimes/Cargo.toml
index 2cc766559..babd3fc4c 100644
--- a/vendor/io-lifetimes/Cargo.toml
+++ b/vendor/io-lifetimes/Cargo.toml
@@ -12,10 +12,18 @@
[package]
edition = "2018"
name = "io-lifetimes"
-version = "0.7.2"
+version = "1.0.2"
authors = ["Dan Gohman <dev@sunfishcode.online>"]
-exclude = ["/.github"]
+include = [
+ "src",
+ "build.rs",
+ "Cargo.toml",
+ "COPYRIGHT",
+ "LICENSE*",
+ "/*.md",
+]
description = "A low-level I/O ownership and borrowing library"
+readme = "README.md"
keywords = [
"api",
"io",
@@ -27,16 +35,22 @@ categories = [
license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT"
repository = "https://github.com/sunfishcode/io-lifetimes"
-[dependencies.async-std]
-version = "1.9.0"
-features = ["unstable"]
-optional = true
-
[dependencies.fs-err]
version = "2.6.0"
optional = true
-[dependencies.mio]
+[features]
+close = [
+ "libc",
+ "windows-sys",
+]
+default = ["close"]
+
+[target."cfg(not(target_os = \"wasi\"))".dependencies.async-std]
+version = "1.12.0"
+optional = true
+
+[target."cfg(not(target_os = \"wasi\"))".dependencies.mio]
version = "0.8.0"
features = [
"net",
@@ -44,11 +58,16 @@ features = [
]
optional = true
-[dependencies.socket2]
+[target."cfg(not(target_os = \"wasi\"))".dependencies.os_pipe]
+version = "1.0.0"
+features = ["io_safety"]
+optional = true
+
+[target."cfg(not(target_os = \"wasi\"))".dependencies.socket2]
version = "0.4.0"
optional = true
-[dependencies.tokio]
+[target."cfg(not(target_os = \"wasi\"))".dependencies.tokio]
version = "1.6.0"
features = [
"io-std",
@@ -58,23 +77,12 @@ features = [
]
optional = true
-[features]
-close = [
- "libc",
- "windows-sys",
-]
-default = ["close"]
-
-[target."cfg(not(target_os = \"wasi\"))".dependencies.os_pipe]
-version = "1.0.0"
-optional = true
-
[target."cfg(not(windows))".dependencies.libc]
version = "0.2.96"
optional = true
[target."cfg(windows)".dependencies.windows-sys]
-version = "0.36.0"
+version = "0.42.0"
features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
diff --git a/vendor/io-lifetimes/README.md b/vendor/io-lifetimes/README.md
index 3db3d3c36..db22b0ded 100644
--- a/vendor/io-lifetimes/README.md
+++ b/vendor/io-lifetimes/README.md
@@ -20,9 +20,6 @@ This is associated with [RFC 3128], the I/O Safety RFC, which is now merged.
Work is now underway to move the `OwnedFd` and `BorrowedFd` types and `AsFd`
trait developed here into `std`.
-Some features currently require nightly Rust, as they depend on `rustc_attrs`
-to perform niche optimizations needed for FFI use cases.
-
For a quick taste, check out the code examples:
- [hello], a basic demo of this API, doing low-level I/O manually, using the
@@ -75,7 +72,7 @@ in the Windows API.
Here's the fun part. `BorrowedFd` and `OwnedFd` are `repr(transparent)` and
hold `RawFd` values, and `Option<BorrowedFd>` and `Option<OwnedFd>` are
-FFI-safe (on nightly Rust), so they can all be used in FFI [directly]:
+FFI-safe (on Rust >= 1.63), so they can all be used in FFI [directly]:
[directly]: https://github.com/sunfishcode/io-lifetimes/blob/main/src/example_ffi.rs
@@ -95,37 +92,16 @@ is what motivates having `BorrowedFd` instead of just using `&OwnedFd`.
Note the use of `Option<OwnedFd>` as the return value of `open`, representing
the fact that it can either succeed or fail.
-## I/O Safety in Rust Nightly
-
-The I/O Safety
-[implementation PR](https://github.com/rust-lang/rust/pull/87329) has now
-landed and is available on Rust Nightly. It can be used directly, or through
-io-lifetimes: when `io_lifetimes_use_std` mode is enabled, io-lifetimes uses
-the std's `OwnedFd`, `BorrowedFd`, and `AsFd` instead of defining its own.
-
-To enable `io_lifetimes_use_std` mode:
- - Set the environment variable `RUSTFLAGS=--cfg=io_lifetimes_use_std`, and
- - add `#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]` to your
- lib.rs or main.rs.
-
-Note that, unfortunately, `io_lifetimes_use_std` mode doesn't support the
-optional impls for third-party crates.
+## I/O Safety in Rust
-The code in `std` uses `From<OwnedFd>` and `Into<OwnedFd>` instead of `FromFd`
-and `IntoFd`. io-lifetimes is unable to provide impls for these for third-party
-types, so it continues to provide `FromFd` and `IntoFd` for now, with default
-impls that forward to `From<OwnedFd>` and `Into<OwnedFd>` in
-`io_lifetimes_use_std` mode.
+I/O Safety feature is stablized in Rust 1.63. With this version or later,
+io-lifetimes will use and re-export the standard-library types and traits. With
+older versions, io-lifetimes defines its own copy of these types and traits.
io-lifetimes also includes several features which are not (yet?) in std,
including the portability traits `AsFilelike`/`AsSocketlike`/etc., the
`from_into_*` functions in the `From*` traits, and [views].
-If you test a crate with the std I/O safety types and traits, or io-lifetimes
-in `io_lifetimes_use_std` mode, please post a note about it in the
-[I/O safety tracking issue] as an example of usage.
-
-[I/O safety tracking issue]: https://github.com/rust-lang/rust/issues/87074
[views]: https://docs.rs/io-lifetimes/*/io_lifetimes/views/index.html
## Prior Art
@@ -148,7 +124,7 @@ be added.
io-lifetimes's distinguishing features are its use of `repr(transparent)`
to support direct FFI usage, niche optimizations so `Option` can support direct
-FFI usafe as well (on nightly Rust), lifetime-aware `As*`/`Into*`/`From*`
+FFI usafe as well (on Rust >= 1.63), lifetime-aware `As*`/`Into*`/`From*`
traits which leverage Rust's lifetime system and allow safe and checked
`from_*` and `as_*`/`into_*` functions, and powerful convenience features
enabled by its underlying safety.
@@ -167,7 +143,7 @@ io-lifetimes's [`OwnedFd`] type is also similar to
[filedesc](https://crates.io/crates/filedesc)'s
[`FileDesc`](https://docs.rs/filedesc/0.3.0/filedesc/struct.FileDesc.html)
io-lifetimes's `OwnedFd` reserves the value -1, so it doesn't need to test for
-`-1` in its `Drop`, and `Option<OwnedFd>` (on nightly Rust) is the same size
+`-1` in its `Drop`, and `Option<OwnedFd>` (on Rust >= 1.63) is the same size
as `FileDesc`.
io-lifetimes's [`OwnedFd`] type is also similar to
@@ -191,6 +167,13 @@ they're simpler and safer to use. io-lifetimes doesn't include unsafe-io's
`*ReadWrite*` or `*HandleOrSocket*` abstractions, and leaves these as features
to be provided by separate layers on top.
+## Minimum Supported Rust Version (MSRV)
+
+This crate currently works on the version of [Rust on Debian stable], which is
+currently Rust 1.48. This policy may change in the future, in minor version
+releases, so users using a fixed version of Rust should pin to a specific
+version of this crate.
+
[`OwnedFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/struct.OwnedFd.html
[`BorrowedFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/struct.BorrowedFd.html
[RFC 3128]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
diff --git a/vendor/io-lifetimes/build.rs b/vendor/io-lifetimes/build.rs
index 81026863f..fd3c6ccce 100644
--- a/vendor/io-lifetimes/build.rs
+++ b/vendor/io-lifetimes/build.rs
@@ -2,9 +2,14 @@ use std::env::var;
use std::io::Write;
fn main() {
- // Niche optimizations for `Borrowed*` and `Owned*` depend on `rustc_attrs`
- // which, outside of `std`, are only available on nightly.
- use_feature_or_nothing("rustc_attrs");
+ // I/O safety is stabilized in Rust 1.63.
+ if has_io_safety() {
+ use_feature("io_safety_is_in_std")
+ }
+
+ // Work around
+ // https://github.com/rust-lang/rust/issues/103306.
+ use_feature_or_nothing("wasi_ext");
// Rust 1.56 and earlier don't support panic in const fn.
if has_panic_in_const_fn() {
@@ -30,10 +35,13 @@ fn use_feature(feature: &str) {
fn has_feature(feature: &str) -> bool {
let out_dir = var("OUT_DIR").unwrap();
let rustc = var("RUSTC").unwrap();
+ let target = var("TARGET").unwrap();
let mut child = std::process::Command::new(rustc)
.arg("--crate-type=rlib") // Don't require `main`.
.arg("--emit=metadata") // Do as little as possible but still parse.
+ .arg("--target")
+ .arg(target)
.arg("--out-dir")
.arg(out_dir) // Put the output somewhere inconsequential.
.arg("-") // Read from stdin.
@@ -50,10 +58,13 @@ fn has_feature(feature: &str) -> bool {
fn has_panic_in_const_fn() -> bool {
let out_dir = var("OUT_DIR").unwrap();
let rustc = var("RUSTC").unwrap();
+ let target = var("TARGET").unwrap();
let mut child = std::process::Command::new(rustc)
.arg("--crate-type=rlib") // Don't require `main`.
.arg("--emit=metadata") // Do as little as possible but still parse.
+ .arg("--target")
+ .arg(target)
.arg("--out-dir")
.arg(out_dir) // Put the output somewhere inconsequential.
.arg("-") // Read from stdin.
@@ -65,3 +76,39 @@ fn has_panic_in_const_fn() -> bool {
child.wait().unwrap().success()
}
+
+/// Test whether the rustc at `var("RUSTC")` supports the I/O safety feature.
+fn has_io_safety() -> bool {
+ let out_dir = var("OUT_DIR").unwrap();
+ let rustc = var("RUSTC").unwrap();
+ let target = var("TARGET").unwrap();
+
+ let mut child = std::process::Command::new(rustc)
+ .arg("--crate-type=rlib") // Don't require `main`.
+ .arg("--emit=metadata") // Do as little as possible but still parse.
+ .arg("--target")
+ .arg(target)
+ .arg("--out-dir")
+ .arg(out_dir) // Put the output somewhere inconsequential.
+ .arg("-") // Read from stdin.
+ .stdin(std::process::Stdio::piped()) // Stdin is a pipe.
+ .spawn()
+ .unwrap();
+
+ writeln!(
+ child.stdin.take().unwrap(),
+ "\
+ #[cfg(unix)]\n\
+ use std::os::unix::io::OwnedFd as Owned;\n\
+ #[cfg(target_os = \"wasi\")]\n\
+ use std::os::wasi::io::OwnedFd as Owned;\n\
+ #[cfg(windows)]\n\
+ use std::os::windows::io::OwnedHandle as Owned;\n\
+ \n\
+ pub type Success = Owned;\n\
+ "
+ )
+ .unwrap();
+
+ child.wait().unwrap().success()
+}
diff --git a/vendor/io-lifetimes/examples/easy-conversions.rs b/vendor/io-lifetimes/examples/easy-conversions.rs
deleted file mode 100644
index 87481c12f..000000000
--- a/vendor/io-lifetimes/examples/easy-conversions.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-//! io-lifetimes provides safe, portable, and convenient conversions from types
-//! implementing `IntoFilelike` and `FromSocketlike` to types implementing
-//! `FromFilelike` and `IntoSocketlike`, respectively.
-
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-use io_lifetimes::FromFilelike;
-use std::fs::File;
-use std::io::{self, Read};
-use std::process::{Command, Stdio};
-
-fn main() -> io::Result<()> {
- let mut child = Command::new("cargo")
- .arg("--help")
- .stdout(Stdio::piped())
- .spawn()
- .expect("failed to execute child");
-
- // Convert from `ChildStderr` into `File` without any platform-specific
- // code or `unsafe`!
- let mut file = File::from_into_filelike(child.stdout.take().unwrap());
-
- // Well, this example is not actually that cool, because `File` doesn't let
- // you do anything that you couldn't already do with `ChildStderr` etc., but
- // it's useful outside of standard library types.
- let mut buffer = String::new();
- file.read_to_string(&mut buffer)?;
-
- Ok(())
-}
diff --git a/vendor/io-lifetimes/examples/flexible-apis.rs b/vendor/io-lifetimes/examples/flexible-apis.rs
deleted file mode 100644
index 8eb19a287..000000000
--- a/vendor/io-lifetimes/examples/flexible-apis.rs
+++ /dev/null
@@ -1,108 +0,0 @@
-//! io-lifetimes provides two different options for library authors
-//! writing APIs which accept untyped I/O resources.
-//!
-//! The following uses the POSIX-ish `Fd` types; similar considerations
-//! apply to the Windows and portable types.
-
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-#[cfg(all(feature = "close", not(windows)))]
-use io_lifetimes::{AsFd, BorrowedFd, IntoFd, OwnedFd};
-
-/// The simplest way to accept a borrowed I/O resource is to simply use a
-/// `BorrwedFd` as an argument. This doesn't require the function to have any
-/// type parameters. It also works in FFI signatures, as `BorrowedFd` and (on
-/// Rust nightly) `Option<BorrowedFd>` are guaranteed to have the same layout
-/// as `RawFd`.
-///
-/// Callers with an `AsFd`-implementing type would call `.as_fd()` and pass
-/// the result.
-#[cfg(all(feature = "close", not(windows)))]
-fn use_fd_a(fd: BorrowedFd<'_>) {
- let _ = fd;
-}
-
-/// Another way to do this is to use an `AsFd` type parameter. This is more
-/// verbose at the function definition site, and entails monomorphization, but
-/// it has the advantage of allowing users to pass in any type implementing
-/// `AsFd` directly, without having to call `.as_fd()` themselves.
-#[cfg(all(feature = "close", not(windows)))]
-fn use_fd_b<Fd: AsFd>(fd: Fd) {
- let _ = fd.as_fd();
-}
-
-/// Another way to do this is to use an `impl AsFd` parameter.
-#[cfg(all(feature = "close", not(windows)))]
-fn use_fd_c(fd: impl AsFd) {
- let _ = fd.as_fd();
-}
-
-/// The simplest way to accept a consumed I/O resource is to simply use an
-/// `OwnedFd` as an argument. Similar to `use_fd_a`, this doesn't require the
-/// function to have any type parameters, and also works in FFI signatures.
-///
-/// Callers with an `IntoFd`-implementing type would call `.into_fd()` and pass
-/// the result.
-#[cfg(all(feature = "close", not(windows)))]
-fn consume_fd_a(fd: OwnedFd) {
- let _ = fd;
-}
-
-/// Another way to do this is to use an `IntoFd` type parameter. Similar to
-/// `use_fd_b`, this is more verbose here and entails monomorphization, but it
-/// has the advantage of allowing users to pass in any type implementing
-/// `IntoFd` directly.
-#[cfg(all(feature = "close", not(windows)))]
-fn consume_fd_b<Fd: IntoFd>(fd: Fd) {
- let _ = fd.into_fd();
-}
-
-/// Another way to do this is to use an `impl IntoFd` parameter.
-#[cfg(all(feature = "close", not(windows)))]
-fn consume_fd_c(fd: impl IntoFd) {
- let _ = fd.into_fd();
-}
-
-/// Now let's see how the APIs look for users.
-#[cfg(all(feature = "close", not(windows)))]
-fn main() {
- let f = std::fs::File::open("Cargo.toml").unwrap();
-
- // The simple option requires an `.as_fd()` at the callsite.
- use_fd_a(f.as_fd());
-
- // Another option can take a reference to any owning type directly.
- use_fd_b(&f);
-
- // Of course, users can still pass in `BorrowedFd` values if they want to.
- use_fd_b(f.as_fd());
-
- // The other option is `impl AsFd`.
- use_fd_c(&f);
-
- // Users can still pass in `BorrowedFd` values if they want to here too.
- use_fd_c(f.as_fd());
-
- let a = std::fs::File::open("Cargo.toml").unwrap();
- let b = std::fs::File::open("Cargo.toml").unwrap();
- let c = std::fs::File::open("Cargo.toml").unwrap();
-
- // The simple option requires an `.into_fd()` at the callsite.
- consume_fd_a(a.into_fd());
-
- // Another option can take any `IntoFd` type directly.
- consume_fd_b(b);
-
- // The other option can take any `IntoFd` type directly.
- consume_fd_c(c);
-}
-
-#[cfg(windows)]
-fn main() {
- println!("This example uses non-Windows APIs.");
-}
-
-#[cfg(all(not(feature = "close"), not(windows)))]
-fn main() {
- println!("This example requires the \"close\" feature.");
-}
diff --git a/vendor/io-lifetimes/examples/hello.rs b/vendor/io-lifetimes/examples/hello.rs
deleted file mode 100644
index 4f6b1a4ed..000000000
--- a/vendor/io-lifetimes/examples/hello.rs
+++ /dev/null
@@ -1,129 +0,0 @@
-//! A simple testcase that prints a few messages to the console, demonstrating
-//! the io-lifetimes API.
-
-#![cfg_attr(not(rustc_attrs), allow(unused_imports))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-#[cfg(feature = "close")]
-use io_lifetimes::example_ffi::*;
-#[cfg(feature = "close")]
-use std::{
- fs::File,
- io::{self, Write},
-};
-
-#[cfg(all(unix, feature = "close"))]
-use io_lifetimes::{AsFd, FromFd, OwnedFd};
-
-#[cfg(windows)]
-use io_lifetimes::{AsHandle, FromHandle, OwnedHandle};
-#[cfg(windows)]
-use std::{convert::TryInto, os::windows::io::RawHandle, ptr::null_mut};
-
-#[cfg(all(rustc_attrs, unix, feature = "close"))]
-fn main() -> io::Result<()> {
- let fd = unsafe {
- // Open a file, which returns an `Option<OwnedFd>`, which we can
- // maybe convert into an `OwnedFile`.
- let fd: OwnedFd = open("/dev/stdout\0".as_ptr() as *const _, O_WRONLY | O_CLOEXEC)
- .ok_or_else(io::Error::last_os_error)?;
-
- // Borrow the fd to write to it.
- let result = write(fd.as_fd(), "hello, world\n".as_ptr() as *const _, 13);
- match result {
- -1 => return Err(io::Error::last_os_error()),
- 13 => (),
- _ => return Err(io::Error::new(io::ErrorKind::Other, "short write")),
- }
-
- fd
- };
-
- // Convert into a `File`. No `unsafe` here!
- let mut file = File::from_fd(fd);
- writeln!(&mut file, "greetings, y'all")?;
-
- // We can borrow a `BorrowedFd` from a `File`.
- unsafe {
- let result = write(file.as_fd(), "sup?\n".as_ptr() as *const _, 5);
- match result {
- -1 => return Err(io::Error::last_os_error()),
- 5 => (),
- _ => return Err(io::Error::new(io::ErrorKind::Other, "short write")),
- }
- }
-
- // `OwnedFd` closes the fd in its `Drop` implementation.
-
- Ok(())
-}
-
-/// The Windows analog of the above.
-#[cfg(all(windows, feature = "close"))]
-fn main() -> io::Result<()> {
- let handle = unsafe {
- // Open a file, which returns an `HandleOrInvalid`, which we can fallibly
- // convert into an `OwnedFile`.
- let handle: OwnedHandle = CreateFileW(
- ['C' as u16, 'O' as _, 'N' as _, 0].as_ptr(),
- FILE_GENERIC_WRITE,
- 0,
- null_mut(),
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- null_mut() as RawHandle as HANDLE,
- )
- .try_into()
- .map_err(|_err| io::Error::last_os_error())?;
-
- // Borrow the handle to write to it.
- let mut number_of_bytes_written = 0;
- let result = WriteFile(
- handle.as_handle(),
- "hello, world\n".as_ptr() as *const _,
- 13,
- &mut number_of_bytes_written,
- null_mut(),
- );
- match (result, number_of_bytes_written) {
- (0, _) => return Err(io::Error::last_os_error()),
- (_, 13) => (),
- (_, _) => return Err(io::Error::new(io::ErrorKind::Other, "short write")),
- }
-
- handle
- };
-
- // Convert into a `File`. No `unsafe` here!
- let mut file = File::from_handle(handle);
- writeln!(&mut file, "greetings, y'all")?;
-
- // We can borrow a `BorrowedHandle` from a `File`.
- unsafe {
- let mut number_of_bytes_written = 0;
- let result = WriteFile(
- file.as_handle(),
- "sup?\n".as_ptr() as *const _,
- 5,
- &mut number_of_bytes_written,
- null_mut(),
- );
- match (result, number_of_bytes_written) {
- (0, _) => return Err(io::Error::last_os_error()),
- (_, 5) => (),
- (_, _) => return Err(io::Error::new(io::ErrorKind::Other, "short write")),
- }
- }
-
- // `OwnedHandle` closes the handle in its `Drop` implementation.
-
- Ok(())
-}
-
-#[cfg(all(
- not(all(rustc_attrs, unix, feature = "close")),
- not(all(windows, feature = "close"))
-))]
-fn main() {
- println!("On Unix, this example requires Rust nightly (for `rustc_attrs`) and the \"close\" feature.");
-}
diff --git a/vendor/io-lifetimes/examples/owning-wrapper.rs b/vendor/io-lifetimes/examples/owning-wrapper.rs
deleted file mode 100644
index 74a05b2f4..000000000
--- a/vendor/io-lifetimes/examples/owning-wrapper.rs
+++ /dev/null
@@ -1,147 +0,0 @@
-//! A simple example implementing the main traits for a type.
-
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-use io_lifetimes::OwnedFilelike;
-#[cfg(not(windows))]
-use io_lifetimes::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
-#[cfg(windows)]
-use io_lifetimes::{AsHandle, BorrowedHandle, FromHandle, IntoHandle, OwnedHandle};
-
-/// A wrapper around a file descriptor.
-///
-/// Implementing `AsFd`, `IntoFd`, and `FromFd` for a type that wraps an
-/// `Owned*` is straightforward. `Owned*` types also automatically close the
-/// handle in its `Drop`.
-///
-/// Should owning wrappers implement `AsRawFd`, `IntoRawFd`, and `FromRawFd`
-/// too? They can, and there's no need to remove them from a type that already
-/// implements them. But for new code, they can be omitted. Users that really
-/// need the raw value can always do `as_fd().as_raw_fd()`,
-/// `.into_fd().into_raw_fd()`, or `T::from_fd(OwnedFd::from_raw_fd(raw_fd))`.
-/// But if possible, users should use just `as_fd`, `into_fd`, and `from_fd`
-/// and avoid working with raw values altogether.
-struct Thing {
- filelike: OwnedFilelike,
-}
-
-#[cfg(not(windows))]
-impl AsFd for Thing {
- #[inline]
- fn as_fd(&self) -> BorrowedFd<'_> {
- self.filelike.as_fd()
- }
-}
-
-#[cfg(not(windows))]
-impl IntoFd for Thing {
- #[inline]
- fn into_fd(self) -> OwnedFd {
- self.filelike
- }
-}
-
-#[cfg(not(io_lifetimes_use_std))]
-#[cfg(not(windows))]
-impl From<Thing> for OwnedFd {
- #[inline]
- fn from(owned: Thing) -> Self {
- owned.filelike
- }
-}
-
-#[cfg(not(windows))]
-impl FromFd for Thing {
- #[inline]
- fn from_fd(filelike: OwnedFd) -> Self {
- Self { filelike }
- }
-}
-
-#[cfg(not(io_lifetimes_use_std))]
-#[cfg(not(windows))]
-impl From<OwnedFd> for Thing {
- #[inline]
- fn from(filelike: OwnedFd) -> Self {
- Self { filelike }
- }
-}
-
-#[cfg(windows)]
-impl AsHandle for Thing {
- #[inline]
- fn as_handle(&self) -> BorrowedHandle<'_> {
- self.filelike.as_handle()
- }
-}
-
-#[cfg(windows)]
-impl IntoHandle for Thing {
- #[inline]
- fn into_handle(self) -> OwnedHandle {
- self.filelike
- }
-}
-
-#[cfg(not(io_lifetimes_use_std))]
-#[cfg(windows)]
-impl From<Thing> for OwnedHandle {
- #[inline]
- fn from(owned: Thing) -> Self {
- owned.filelike
- }
-}
-
-#[cfg(windows)]
-impl FromHandle for Thing {
- #[inline]
- fn from_handle(filelike: OwnedHandle) -> Self {
- Self { filelike }
- }
-}
-
-#[cfg(not(io_lifetimes_use_std))]
-#[cfg(windows)]
-impl From<OwnedHandle> for Thing {
- #[inline]
- fn from(filelike: OwnedHandle) -> Self {
- Self { filelike }
- }
-}
-
-#[cfg(feature = "close")]
-fn main() {
- use io_lifetimes::{AsFilelike, FromFilelike, IntoFilelike};
-
- // Minimally exercise `Thing`'s Posix-ish API.
- #[cfg(not(windows))]
- {
- let file = std::fs::File::open("Cargo.toml").unwrap();
- let thing = Thing::from_into_fd(file);
- let _ = thing.as_fd();
- let _ = thing.into_fd();
- }
-
- // Minimally exercise `Thing`'s Windows API.
- #[cfg(windows)]
- {
- let file = std::fs::File::open("Cargo.toml").unwrap();
- let thing = Thing::from_into_handle(file);
- let _ = thing.as_handle();
- let _ = thing.into_handle();
- }
-
- // Implementing the above traits makes the blanket impls for the portable
- // `Filelike` traits available too.
- {
- let file = std::fs::File::open("Cargo.toml").unwrap();
- let thing = Thing::from_into_filelike(file);
- let _ = thing.as_filelike();
- let _ = thing.into_filelike();
- }
-}
-
-#[cfg(not(feature = "close"))]
-fn main() {
- println!("This example requires the \"close\" feature.");
-}
diff --git a/vendor/io-lifetimes/examples/portable-views.rs b/vendor/io-lifetimes/examples/portable-views.rs
deleted file mode 100644
index 410b4c2f0..000000000
--- a/vendor/io-lifetimes/examples/portable-views.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-//! io-lifetimes provides safe, convenient, and portable ways to temporarily
-//! view an I/O resource as a `File`, `Socket`, or other types.
-
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-use io_lifetimes::AsFilelike;
-use std::fs::File;
-use std::io::{self, stdout};
-
-fn main() -> io::Result<()> {
- let stdout = stdout();
-
- // With `AsFilelike`, any type implementing `AsFd`/`AsHandle` can be viewed
- // as any type supporting `FromFilelike`, so you can call `File` methods on
- // `Stdout` or other things.
- //
- // Whether or not you can actually do this is up to the OS, of course. In
- // this case, Unix can do this, but it appears Windows can't.
- let metadata = stdout.as_filelike_view::<File>().metadata()?;
-
- if metadata.is_file() {
- println!("stdout is a file!");
- } else {
- println!("stdout is not a file!");
- }
-
- Ok(())
-}
diff --git a/vendor/io-lifetimes/src/example_ffi.rs b/vendor/io-lifetimes/src/example_ffi.rs
index 8f7c238ba..0b31b9ec2 100644
--- a/vendor/io-lifetimes/src/example_ffi.rs
+++ b/vendor/io-lifetimes/src/example_ffi.rs
@@ -1,6 +1,6 @@
//! This is just a sample of what FFI using this crate can look like.
-#![cfg_attr(not(rustc_attrs), allow(unused_imports))]
+#![cfg_attr(not(io_safety_is_in_std), allow(unused_imports))]
#![allow(missing_docs)]
#[cfg(any(unix, target_os = "wasi"))]
@@ -23,7 +23,7 @@ use {
};
// Declare a few FFI functions ourselves, to show off the FFI ergonomics.
-#[cfg(all(rustc_attrs, any(unix, target_os = "wasi")))]
+#[cfg(all(io_safety_is_in_std, any(unix, target_os = "wasi")))]
extern "C" {
pub fn open(pathname: *const c_char, flags: c_int, ...) -> Option<OwnedFd>;
}
diff --git a/vendor/io-lifetimes/src/impls_async_std.rs b/vendor/io-lifetimes/src/impls_async_std.rs
index 534700486..7223e9955 100644
--- a/vendor/io-lifetimes/src/impls_async_std.rs
+++ b/vendor/io-lifetimes/src/impls_async_std.rs
@@ -2,7 +2,6 @@
//! future, we'll prefer to have crates provide their own impls; this is
//! just a temporary measure.
-use crate::views::{FilelikeViewType, SocketlikeViewType};
#[cfg(any(unix, target_os = "wasi"))]
use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
#[cfg(windows)]
@@ -101,8 +100,6 @@ impl From<OwnedHandle> for async_std::fs::File {
}
}
-unsafe impl SocketlikeViewType for async_std::net::TcpStream {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for async_std::net::TcpStream {
#[inline]
@@ -183,8 +180,6 @@ impl From<OwnedSocket> for async_std::net::TcpStream {
}
}
-unsafe impl SocketlikeViewType for async_std::net::TcpListener {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for async_std::net::TcpListener {
#[inline]
@@ -265,8 +260,6 @@ impl From<OwnedSocket> for async_std::net::TcpListener {
}
}
-unsafe impl SocketlikeViewType for async_std::net::UdpSocket {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for async_std::net::UdpSocket {
#[inline]
@@ -396,9 +389,6 @@ impl AsHandle for async_std::io::Stderr {
}
#[cfg(unix)]
-unsafe impl SocketlikeViewType for async_std::os::unix::net::UnixStream {}
-
-#[cfg(unix)]
impl AsFd for async_std::os::unix::net::UnixStream {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
@@ -439,9 +429,6 @@ impl From<OwnedFd> for async_std::os::unix::net::UnixStream {
}
#[cfg(unix)]
-unsafe impl SocketlikeViewType for async_std::os::unix::net::UnixListener {}
-
-#[cfg(unix)]
impl AsFd for async_std::os::unix::net::UnixListener {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
@@ -482,9 +469,6 @@ impl From<OwnedFd> for async_std::os::unix::net::UnixListener {
}
#[cfg(unix)]
-unsafe impl SocketlikeViewType for async_std::os::unix::net::UnixDatagram {}
-
-#[cfg(unix)]
impl AsFd for async_std::os::unix::net::UnixDatagram {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
diff --git a/vendor/io-lifetimes/src/impls_mio.rs b/vendor/io-lifetimes/src/impls_mio.rs
index 246f3b93f..486274b09 100644
--- a/vendor/io-lifetimes/src/impls_mio.rs
+++ b/vendor/io-lifetimes/src/impls_mio.rs
@@ -2,9 +2,6 @@
//! future, we'll prefer to have crates provide their own impls; this is
//! just a temporary measure.
-#[cfg(unix)]
-use crate::views::FilelikeViewType;
-use crate::views::SocketlikeViewType;
#[cfg(any(unix, target_os = "wasi"))]
use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
#[cfg(windows)]
@@ -16,8 +13,6 @@ use std::os::wasi::io::{AsRawFd, FromRawFd, IntoRawFd};
#[cfg(windows)]
use std::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket};
-unsafe impl SocketlikeViewType for mio::net::TcpStream {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for mio::net::TcpStream {
#[inline]
@@ -98,8 +93,6 @@ impl From<OwnedSocket> for mio::net::TcpStream {
}
}
-unsafe impl SocketlikeViewType for mio::net::TcpListener {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for mio::net::TcpListener {
#[inline]
@@ -180,8 +173,6 @@ impl From<OwnedSocket> for mio::net::TcpListener {
}
}
-unsafe impl SocketlikeViewType for mio::net::UdpSocket {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for mio::net::UdpSocket {
#[inline]
@@ -263,9 +254,6 @@ impl From<OwnedSocket> for mio::net::UdpSocket {
}
#[cfg(unix)]
-unsafe impl SocketlikeViewType for mio::net::UnixDatagram {}
-
-#[cfg(unix)]
impl AsFd for mio::net::UnixDatagram {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
@@ -306,9 +294,6 @@ impl From<OwnedFd> for mio::net::UnixDatagram {
}
#[cfg(unix)]
-unsafe impl SocketlikeViewType for mio::net::UnixListener {}
-
-#[cfg(unix)]
impl AsFd for mio::net::UnixListener {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
@@ -349,9 +334,6 @@ impl From<OwnedFd> for mio::net::UnixListener {
}
#[cfg(unix)]
-unsafe impl SocketlikeViewType for mio::net::UnixStream {}
-
-#[cfg(unix)]
impl AsFd for mio::net::UnixStream {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
@@ -392,9 +374,6 @@ impl From<OwnedFd> for mio::net::UnixStream {
}
#[cfg(unix)]
-unsafe impl FilelikeViewType for mio::unix::pipe::Receiver {}
-
-#[cfg(unix)]
impl AsFd for mio::unix::pipe::Receiver {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
@@ -435,9 +414,6 @@ impl From<OwnedFd> for mio::unix::pipe::Receiver {
}
#[cfg(unix)]
-unsafe impl FilelikeViewType for mio::unix::pipe::Sender {}
-
-#[cfg(unix)]
impl AsFd for mio::unix::pipe::Sender {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
diff --git a/vendor/io-lifetimes/src/impls_os_pipe.rs b/vendor/io-lifetimes/src/impls_os_pipe.rs
index e0544873e..4c1d1bf67 100644
--- a/vendor/io-lifetimes/src/impls_os_pipe.rs
+++ b/vendor/io-lifetimes/src/impls_os_pipe.rs
@@ -2,7 +2,6 @@
//! future, we'll prefer to have crates provide their own impls; this is
//! just a temporary measure.
-use crate::views::FilelikeViewType;
#[cfg(any(unix, target_os = "wasi"))]
use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
#[cfg(windows)]
@@ -14,8 +13,6 @@ use std::os::wasi::io::{AsRawFd, FromRawFd, IntoRawFd};
#[cfg(windows)]
use std::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle};
-unsafe impl FilelikeViewType for os_pipe::PipeReader {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for os_pipe::PipeReader {
#[inline]
@@ -96,8 +93,6 @@ impl From<OwnedHandle> for os_pipe::PipeReader {
}
}
-unsafe impl FilelikeViewType for os_pipe::PipeWriter {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for os_pipe::PipeWriter {
#[inline]
diff --git a/vendor/io-lifetimes/src/impls_socket2.rs b/vendor/io-lifetimes/src/impls_socket2.rs
index fbfeb67d7..3dc4f9eea 100644
--- a/vendor/io-lifetimes/src/impls_socket2.rs
+++ b/vendor/io-lifetimes/src/impls_socket2.rs
@@ -2,7 +2,6 @@
//! future, we'll prefer to have crates provide their own impls; this is
//! just a temporary measure.
-use crate::views::SocketlikeViewType;
#[cfg(any(unix, target_os = "wasi"))]
use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
#[cfg(windows)]
@@ -14,8 +13,6 @@ use std::os::wasi::io::{AsRawFd, FromRawFd, IntoRawFd};
#[cfg(windows)]
use std::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket};
-unsafe impl SocketlikeViewType for socket2::Socket {}
-
#[cfg(any(unix, target_os = "wasi"))]
impl AsFd for socket2::Socket {
#[inline]
diff --git a/vendor/io-lifetimes/src/impls_std.rs b/vendor/io-lifetimes/src/impls_std.rs
index 27275fa68..145bb1982 100644
--- a/vendor/io-lifetimes/src/impls_std.rs
+++ b/vendor/io-lifetimes/src/impls_std.rs
@@ -1,3 +1,5 @@
+#![allow(deprecated)] // Don't warn on `IntoFd` and `FromFd` impls.
+
#[cfg(any(unix, target_os = "wasi"))]
use crate::{AsFd, FromFd, IntoFd};
#[cfg(windows)]
diff --git a/vendor/io-lifetimes/src/impls_std_views.rs b/vendor/io-lifetimes/src/impls_std_views.rs
deleted file mode 100644
index ffa013ffa..000000000
--- a/vendor/io-lifetimes/src/impls_std_views.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-use crate::views::{FilelikeViewType, SocketlikeViewType};
-#[cfg(any(unix, target_os = "wasi"))]
-use crate::OwnedFd;
-#[cfg(windows)]
-use crate::{OwnedHandle, OwnedSocket};
-
-#[cfg(any(unix, target_os = "wasi"))]
-unsafe impl FilelikeViewType for OwnedFd {}
-
-#[cfg(windows)]
-unsafe impl FilelikeViewType for OwnedHandle {}
-
-#[cfg(windows)]
-unsafe impl SocketlikeViewType for OwnedSocket {}
-
-unsafe impl FilelikeViewType for std::fs::File {}
-
-unsafe impl SocketlikeViewType for std::net::TcpStream {}
-
-unsafe impl SocketlikeViewType for std::net::TcpListener {}
-
-unsafe impl SocketlikeViewType for std::net::UdpSocket {}
-
-#[cfg(unix)]
-unsafe impl SocketlikeViewType for std::os::unix::net::UnixStream {}
-
-#[cfg(unix)]
-unsafe impl SocketlikeViewType for std::os::unix::net::UnixListener {}
-
-#[cfg(unix)]
-unsafe impl SocketlikeViewType for std::os::unix::net::UnixDatagram {}
diff --git a/vendor/io-lifetimes/src/lib.rs b/vendor/io-lifetimes/src/lib.rs
index 5e2a9d19f..da5e740cf 100644
--- a/vendor/io-lifetimes/src/lib.rs
+++ b/vendor/io-lifetimes/src/lib.rs
@@ -28,47 +28,47 @@
//! [from+into conversions]: FromFilelike::from_into_filelike
#![deny(missing_docs)]
-#![cfg_attr(rustc_attrs, feature(rustc_attrs))]
-#![cfg_attr(all(io_lifetimes_use_std, target_os = "wasi"), feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
+// Work around https://github.com/rust-lang/rust/issues/103306.
+#![cfg_attr(all(wasi_ext, target_os = "wasi"), feature(wasi_ext))]
mod portability;
mod traits;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
mod types;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
mod impls_std;
-mod impls_std_views;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(any(unix, target_os = "wasi"))]
pub use traits::AsFd;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
pub use traits::{AsHandle, AsSocket};
#[cfg(any(unix, target_os = "wasi"))]
+#[allow(deprecated)]
pub use traits::{FromFd, IntoFd};
#[cfg(windows)]
+#[allow(deprecated)]
pub use traits::{FromHandle, FromSocket, IntoHandle, IntoSocket};
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(any(unix, target_os = "wasi"))]
pub use types::{BorrowedFd, OwnedFd};
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
pub use types::{
BorrowedHandle, BorrowedSocket, HandleOrInvalid, InvalidHandleError, NullHandleError,
OwnedHandle, OwnedSocket,
};
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(unix)]
pub use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd};
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(target_os = "wasi")]
pub use std::os::wasi::io::{AsFd, BorrowedFd, OwnedFd};
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
pub use std::os::windows::io::{
AsHandle, AsSocket, BorrowedHandle, BorrowedSocket, HandleOrInvalid, InvalidHandleError,
@@ -86,16 +86,18 @@ pub use std::os::windows::io::{
//
// So we define `FromFd`/`IntoFd` traits, and implement them in terms of
// `From`/`Into`,
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(any(unix, target_os = "wasi"))]
+#[allow(deprecated)]
impl<T: From<OwnedFd>> FromFd for T {
#[inline]
fn from_fd(owned_fd: OwnedFd) -> Self {
owned_fd.into()
}
}
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(any(unix, target_os = "wasi"))]
+#[allow(deprecated)]
impl<T> IntoFd for T
where
OwnedFd: From<T>,
@@ -106,16 +108,18 @@ where
}
}
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
+#[allow(deprecated)]
impl<T: From<OwnedHandle>> FromHandle for T {
#[inline]
fn from_handle(owned_handle: OwnedHandle) -> Self {
owned_handle.into()
}
}
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
+#[allow(deprecated)]
impl<T> IntoHandle for T
where
OwnedHandle: From<T>,
@@ -126,16 +130,18 @@ where
}
}
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
+#[allow(deprecated)]
impl<T: From<OwnedSocket>> FromSocket for T {
#[inline]
fn from_socket(owned_socket: OwnedSocket) -> Self {
owned_socket.into()
}
}
-#[cfg(io_lifetimes_use_std)]
+#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
+#[allow(deprecated)]
impl<T> IntoSocket for T
where
OwnedSocket: From<T>,
@@ -158,22 +164,22 @@ pub mod views;
// Ideally, we'd want crates to implement our traits themselves. But for now,
// while we're prototyping, we provide a few impls on foreign types.
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "async-std")]
mod impls_async_std;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "fs-err")]
mod impls_fs_err;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "mio")]
mod impls_mio;
#[cfg(not(target_os = "wasi"))]
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "os_pipe")]
mod impls_os_pipe;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "socket2")]
mod impls_socket2;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "tokio")]
mod impls_tokio;
diff --git a/vendor/io-lifetimes/src/portability.rs b/vendor/io-lifetimes/src/portability.rs
index ee9057501..eb630ce9f 100644
--- a/vendor/io-lifetimes/src/portability.rs
+++ b/vendor/io-lifetimes/src/portability.rs
@@ -6,12 +6,9 @@
use crate::views::{FilelikeView, FilelikeViewType, SocketlikeView, SocketlikeViewType};
#[cfg(any(unix, target_os = "wasi"))]
-use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
+use crate::{AsFd, BorrowedFd, OwnedFd};
#[cfg(windows)]
-use crate::{
- AsHandle, AsSocket, BorrowedHandle, BorrowedSocket, FromHandle, FromSocket, IntoHandle,
- IntoSocket, OwnedHandle, OwnedSocket,
-};
+use crate::{AsHandle, AsSocket, BorrowedHandle, BorrowedSocket, OwnedHandle, OwnedSocket};
/// A reference to a filelike object.
///
@@ -104,6 +101,8 @@ pub trait AsFilelike: AsFd {
/// ```
///
/// [`File`]: std::fs::File
+ /// [`Read`]: std::io::Read
+ /// [`Write`]: std::io::Write
fn as_filelike_view<Target: FilelikeViewType>(&self) -> FilelikeView<'_, Target>;
}
@@ -155,6 +154,8 @@ pub trait AsFilelike: AsHandle {
/// ```
///
/// [`File`]: std::fs::File
+ /// [`Read`]: std::io::Read
+ /// [`Write`]: std::io::Write
fn as_filelike_view<Target: FilelikeViewType>(&self) -> FilelikeView<'_, Target>;
}
@@ -195,6 +196,8 @@ pub trait AsSocketlike: AsFd {
/// ```
///
/// [`TcpStream`]: std::net::TcpStream
+ /// [`Read`]: std::io::Read
+ /// [`Write`]: std::io::Write
fn as_socketlike_view<Target: SocketlikeViewType>(&self) -> SocketlikeView<'_, Target>;
}
@@ -254,10 +257,10 @@ impl<T: AsSocket> AsSocketlike for T {
/// A portable trait to express the ability to consume an object and acquire
/// ownership of its filelike object.
///
-/// This is a portability abstraction over Unix-like [`IntoFd`] and Windows'
-/// `IntoHandle`.
+/// This is a portability abstraction over Unix-like [`Into<OwnedFd>`] and Windows'
+/// `Into<OwnedHandle>`.
#[cfg(any(unix, target_os = "wasi"))]
-pub trait IntoFilelike: IntoFd {
+pub trait IntoFilelike: Into<OwnedFd> {
/// Consumes this object, returning the underlying filelike object.
///
/// # Example
@@ -275,58 +278,58 @@ pub trait IntoFilelike: IntoFd {
}
#[cfg(any(unix, target_os = "wasi"))]
-impl<T: IntoFd> IntoFilelike for T {
+impl<T: Into<OwnedFd>> IntoFilelike for T {
#[inline]
fn into_filelike(self) -> OwnedFilelike {
- self.into_fd()
+ self.into()
}
}
/// A portable trait to express the ability to consume an object and acquire
/// ownership of its filelike object.
///
-/// This is a portability abstraction over Unix-like `IntoFd` and Windows'
-/// [`IntoHandle`].
+/// This is a portability abstraction over Unix-like `Into<OwnedFd>` and Windows'
+/// [`Into<OwnedHandle>`].
#[cfg(windows)]
-pub trait IntoFilelike: IntoHandle {
+pub trait IntoFilelike: Into<OwnedHandle> {
/// Consumes this object, returning the underlying filelike object.
fn into_filelike(self) -> OwnedFilelike;
}
#[cfg(windows)]
-impl<T: IntoHandle> IntoFilelike for T {
+impl<T: Into<OwnedHandle>> IntoFilelike for T {
#[inline]
fn into_filelike(self) -> OwnedFilelike {
- self.into_handle()
+ self.into()
}
}
/// A portable trait to express the ability to consume an object and acquire
/// ownership of its socketlike object.
///
-/// This is a portability abstraction over Unix-like [`IntoFd`] and Windows'
-/// `IntoSocket`.
+/// This is a portability abstraction over Unix-like [`Into<OwnedFd>`] and Windows'
+/// `Into<OwnedSocket>`.
#[cfg(any(unix, target_os = "wasi"))]
-pub trait IntoSocketlike: IntoFd {
+pub trait IntoSocketlike: Into<OwnedFd> {
/// Consumes this object, returning the underlying socketlike object.
fn into_socketlike(self) -> OwnedSocketlike;
}
#[cfg(any(unix, target_os = "wasi"))]
-impl<T: IntoFd> IntoSocketlike for T {
+impl<T: Into<OwnedFd>> IntoSocketlike for T {
#[inline]
fn into_socketlike(self) -> OwnedSocketlike {
- self.into_fd()
+ self.into()
}
}
/// A portable trait to express the ability to consume an object and acquire
/// ownership of its socketlike object.
///
-/// This is a portability abstraction over Unix-like `IntoFd` and Windows'
-/// [`IntoSocket`].
+/// This is a portability abstraction over Unix-like `Into<OwnedFd>` and Windows'
+/// [`Into<OwnedSocket>`].
#[cfg(windows)]
-pub trait IntoSocketlike: IntoSocket {
+pub trait IntoSocketlike: Into<OwnedSocket> {
/// Consumes this object, returning the underlying socketlike object.
///
/// # Example
@@ -344,21 +347,21 @@ pub trait IntoSocketlike: IntoSocket {
}
#[cfg(windows)]
-impl<T: IntoSocket> IntoSocketlike for T {
+impl<T: Into<OwnedSocket>> IntoSocketlike for T {
#[inline]
fn into_socketlike(self) -> OwnedSocketlike {
- self.into_socket()
+ self.into()
}
}
/// A portable trait to express the ability to construct an object from a
/// filelike object.
///
-/// This is a portability abstraction over Unix-like [`FromFd`] and Windows'
-/// `FromHandle`. It also provides the `from_into_filelike` convenience
+/// This is a portability abstraction over Unix-like [`From<OwnedFd>`] and Windows'
+/// `From<OwnedHandle>`. It also provides the `from_into_filelike` convenience
/// function providing simplified from+into conversions.
#[cfg(any(unix, target_os = "wasi"))]
-pub trait FromFilelike: FromFd {
+pub trait FromFilelike: From<OwnedFd> {
/// Constructs a new instance of `Self` from the given filelike object.
///
/// # Example
@@ -393,10 +396,10 @@ pub trait FromFilelike: FromFd {
}
#[cfg(any(unix, target_os = "wasi"))]
-impl<T: FromFd> FromFilelike for T {
+impl<T: From<OwnedFd>> FromFilelike for T {
#[inline]
fn from_filelike(owned: OwnedFilelike) -> Self {
- Self::from_fd(owned)
+ Self::from(owned)
}
#[inline]
@@ -408,11 +411,11 @@ impl<T: FromFd> FromFilelike for T {
/// A portable trait to express the ability to construct an object from a
/// filelike object.
///
-/// This is a portability abstraction over Unix-like `FromFd` and Windows'
-/// [`FromHandle`]. It also provides the `from_into_filelike` convenience
+/// This is a portability abstraction over Unix-like `From<OwnedFd>` and Windows'
+/// [`From<OwnedHandle>`]. It also provides the `from_into_filelike` convenience
/// function providing simplified from+into conversions.
#[cfg(windows)]
-pub trait FromFilelike: FromHandle {
+pub trait FromFilelike: From<OwnedHandle> {
/// Constructs a new instance of `Self` from the given filelike object.
///
/// # Example
@@ -447,10 +450,10 @@ pub trait FromFilelike: FromHandle {
}
#[cfg(windows)]
-impl<T: FromHandle> FromFilelike for T {
+impl<T: From<OwnedHandle>> FromFilelike for T {
#[inline]
fn from_filelike(owned: OwnedFilelike) -> Self {
- Self::from_handle(owned)
+ Self::from(owned)
}
#[inline]
@@ -462,11 +465,11 @@ impl<T: FromHandle> FromFilelike for T {
/// A portable trait to express the ability to construct an object from a
/// socketlike object.
///
-/// This is a portability abstraction over Unix-like [`FromFd`] and Windows'
-/// `FromSocket`. It also provides the `from_into_socketlike` convenience
+/// This is a portability abstraction over Unix-like [`From<OwnedFd>`] and Windows'
+/// `From<OwnedSocketFrom<OwnedSocket> It also provides the `from_into_socketlike` convenience
/// function providing simplified from+into conversions.
#[cfg(any(unix, target_os = "wasi"))]
-pub trait FromSocketlike: FromFd {
+pub trait FromSocketlike: From<OwnedFd> {
/// Constructs a new instance of `Self` from the given socketlike object.
fn from_socketlike(owned: OwnedSocketlike) -> Self;
@@ -476,10 +479,10 @@ pub trait FromSocketlike: FromFd {
}
#[cfg(any(unix, target_os = "wasi"))]
-impl<T: FromFd> FromSocketlike for T {
+impl<T: From<OwnedFd>> FromSocketlike for T {
#[inline]
fn from_socketlike(owned: OwnedSocketlike) -> Self {
- Self::from_fd(owned)
+ Self::from(owned)
}
#[inline]
@@ -491,11 +494,11 @@ impl<T: FromFd> FromSocketlike for T {
/// A portable trait to express the ability to construct an object from a
/// socketlike object.
///
-/// This is a portability abstraction over Unix-like `FromFd` and Windows'
-/// [`FromSocket`]. It also provides the `from_into_socketlike` convenience
+/// This is a portability abstraction over Unix-like `From<OwnedFd>` and Windows'
+/// [`From<OwnedSocket>`]. It also provides the `from_into_socketlike` convenience
/// function providing simplified from+into conversions.
#[cfg(windows)]
-pub trait FromSocketlike: FromSocket {
+pub trait FromSocketlike: From<OwnedSocket> {
/// Constructs a new instance of `Self` from the given socketlike object.
fn from_socketlike(owned: OwnedSocketlike) -> Self;
@@ -505,10 +508,10 @@ pub trait FromSocketlike: FromSocket {
}
#[cfg(windows)]
-impl<T: FromSocket> FromSocketlike for T {
+impl<T: From<OwnedSocket>> FromSocketlike for T {
#[inline]
fn from_socketlike(owned: OwnedSocketlike) -> Self {
- Self::from_socket(owned)
+ Self::from(owned)
}
#[inline]
diff --git a/vendor/io-lifetimes/src/traits.rs b/vendor/io-lifetimes/src/traits.rs
index 788045208..7fb9a5bdb 100644
--- a/vendor/io-lifetimes/src/traits.rs
+++ b/vendor/io-lifetimes/src/traits.rs
@@ -1,9 +1,9 @@
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(any(unix, target_os = "wasi"))]
use crate::BorrowedFd;
#[cfg(any(unix, target_os = "wasi"))]
use crate::OwnedFd;
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
use crate::{BorrowedHandle, BorrowedSocket};
#[cfg(windows)]
@@ -14,7 +14,7 @@ use crate::{OwnedHandle, OwnedSocket};
/// This is only available on unix platforms and must be imported in order to
/// call the method. Windows platforms have a corresponding `AsHandle` and
/// `AsSocket` set of traits.
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(any(unix, target_os = "wasi"))]
pub trait AsFd {
/// Borrows the file descriptor.
@@ -22,7 +22,6 @@ pub trait AsFd {
/// # Example
///
/// ```rust,no_run
- /// # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
/// use std::fs::File;
/// # use std::io;
/// use io_lifetimes::{AsFd, BorrowedFd};
@@ -35,7 +34,7 @@ pub trait AsFd {
}
/// A trait to borrow the handle from an underlying object.
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
pub trait AsHandle {
/// Borrows the handle.
@@ -43,7 +42,6 @@ pub trait AsHandle {
/// # Example
///
/// ```rust,no_run
- /// # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
/// use std::fs::File;
/// # use std::io;
/// use io_lifetimes::{AsHandle, BorrowedHandle};
@@ -56,7 +54,7 @@ pub trait AsHandle {
}
/// A trait to borrow the socket from an underlying object.
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
pub trait AsSocket {
/// Borrows the socket.
@@ -66,13 +64,16 @@ pub trait AsSocket {
/// A trait to express the ability to consume an object and acquire ownership
/// of its file descriptor.
#[cfg(any(unix, target_os = "wasi"))]
+#[deprecated(
+ since = "1.0.0",
+ note = "`IntoFd` is replaced by `From<...> for OwnedFd` or `Into<OwnedFd>`"
+)]
pub trait IntoFd {
/// Consumes this object, returning the underlying file descriptor.
///
/// # Example
///
/// ```rust,no_run
- /// # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
/// use std::fs::File;
/// # use std::io;
/// use io_lifetimes::{IntoFd, OwnedFd};
@@ -87,13 +88,16 @@ pub trait IntoFd {
/// A trait to express the ability to consume an object and acquire ownership
/// of its handle.
#[cfg(windows)]
+#[deprecated(
+ since = "1.0.0",
+ note = "`IntoHandle` is replaced by `From<...> for OwnedHandle` or `Into<OwnedHandle>`"
+)]
pub trait IntoHandle {
/// Consumes this object, returning the underlying handle.
///
/// # Example
///
/// ```rust,no_run
- /// # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
/// use std::fs::File;
/// # use std::io;
/// use io_lifetimes::{IntoHandle, OwnedHandle};
@@ -108,6 +112,10 @@ pub trait IntoHandle {
/// A trait to express the ability to consume an object and acquire ownership
/// of its socket.
#[cfg(windows)]
+#[deprecated(
+ since = "1.0.0",
+ note = "`IntoSocket` is replaced by `From<...> for OwnedSocket` or `Into<OwnedSocket>`"
+)]
pub trait IntoSocket {
/// Consumes this object, returning the underlying socket.
fn into_socket(self) -> OwnedSocket;
@@ -122,7 +130,6 @@ pub trait FromFd {
/// # Example
///
/// ```rust,no_run
- /// # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
/// use std::fs::File;
/// # use std::io;
/// use io_lifetimes::{FromFd, IntoFd, OwnedFd};
@@ -132,6 +139,10 @@ pub trait FromFd {
/// let f = File::from_fd(owned_fd);
/// # Ok::<(), io::Error>(())
/// ```
+ #[deprecated(
+ since = "1.0.0",
+ note = "`FromFd::from_fd` is replaced by `From<OwnedFd>::from`"
+ )]
fn from_fd(owned: OwnedFd) -> Self;
/// Constructs a new instance of `Self` from the given file descriptor
@@ -140,7 +151,6 @@ pub trait FromFd {
/// # Example
///
/// ```rust,no_run
- /// # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
/// use std::fs::File;
/// # use std::io;
/// use io_lifetimes::{FromFd, IntoFd};
@@ -150,11 +160,11 @@ pub trait FromFd {
/// # Ok::<(), io::Error>(())
/// ```
#[inline]
- fn from_into_fd<Owned: IntoFd>(into_owned: Owned) -> Self
+ fn from_into_fd<Owned: Into<OwnedFd>>(into_owned: Owned) -> Self
where
- Self: Sized,
+ Self: Sized + From<OwnedFd>,
{
- Self::from_fd(into_owned.into_fd())
+ Self::from(into_owned.into())
}
}
@@ -166,7 +176,6 @@ pub trait FromHandle {
/// # Example
///
/// ```rust,no_run
- /// # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
/// use std::fs::File;
/// # use std::io;
/// use io_lifetimes::{FromHandle, IntoHandle, OwnedHandle};
@@ -176,6 +185,10 @@ pub trait FromHandle {
/// let f = File::from_handle(owned_handle);
/// # Ok::<(), io::Error>(())
/// ```
+ #[deprecated(
+ since = "1.0.0",
+ note = "`FromHandle::from_handle` is replaced by `From<OwnedHandle>::from`"
+ )]
fn from_handle(owned: OwnedHandle) -> Self;
/// Constructs a new instance of `Self` from the given handle converted
@@ -184,7 +197,6 @@ pub trait FromHandle {
/// # Example
///
/// ```rust,no_run
- /// # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
/// use std::fs::File;
/// # use std::io;
/// use io_lifetimes::{FromHandle, IntoHandle};
@@ -194,11 +206,11 @@ pub trait FromHandle {
/// # Ok::<(), io::Error>(())
/// ```
#[inline]
- fn from_into_handle<Owned: IntoHandle>(into_owned: Owned) -> Self
+ fn from_into_handle<Owned: Into<OwnedHandle>>(into_owned: Owned) -> Self
where
- Self: Sized,
+ Self: Sized + From<OwnedHandle>,
{
- Self::from_handle(into_owned.into_handle())
+ Self::from(into_owned.into())
}
}
@@ -206,20 +218,24 @@ pub trait FromHandle {
#[cfg(windows)]
pub trait FromSocket {
/// Constructs a new instance of `Self` from the given socket.
+ #[deprecated(
+ since = "1.0.0",
+ note = "`FromSocket::from_socket` is replaced by `From<OwnedSocket>::from`"
+ )]
fn from_socket(owned: OwnedSocket) -> Self;
/// Constructs a new instance of `Self` from the given socket converted
/// from `into_owned`.
#[inline]
- fn from_into_socket<Owned: IntoSocket>(into_owned: Owned) -> Self
+ fn from_into_socket<Owned: Into<OwnedSocket>>(into_owned: Owned) -> Self
where
- Self: Sized,
+ Self: Sized + From<OwnedSocket>,
{
- Self::from_socket(into_owned.into_socket())
+ Self::from(into_owned.into())
}
}
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(any(unix, target_os = "wasi"))]
impl<T: AsFd> AsFd for &T {
#[inline]
@@ -228,7 +244,7 @@ impl<T: AsFd> AsFd for &T {
}
}
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(any(unix, target_os = "wasi"))]
impl<T: AsFd> AsFd for &mut T {
#[inline]
@@ -237,7 +253,7 @@ impl<T: AsFd> AsFd for &mut T {
}
}
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
impl<T: AsHandle> AsHandle for &T {
#[inline]
@@ -246,7 +262,7 @@ impl<T: AsHandle> AsHandle for &T {
}
}
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
impl<T: AsHandle> AsHandle for &mut T {
#[inline]
@@ -255,7 +271,7 @@ impl<T: AsHandle> AsHandle for &mut T {
}
}
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
impl<T: AsSocket> AsSocket for &T {
#[inline]
@@ -264,7 +280,7 @@ impl<T: AsSocket> AsSocket for &T {
}
}
-#[cfg(not(io_lifetimes_use_std))]
+#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
impl<T: AsSocket> AsSocket for &mut T {
#[inline]
diff --git a/vendor/io-lifetimes/src/types.rs b/vendor/io-lifetimes/src/types.rs
index 695ae513c..7f7809fb0 100644
--- a/vendor/io-lifetimes/src/types.rs
+++ b/vendor/io-lifetimes/src/types.rs
@@ -50,12 +50,6 @@ const INVALID_SOCKET: usize = !0 as _;
#[cfg(any(unix, target_os = "wasi"))]
#[derive(Copy, Clone)]
#[repr(transparent)]
-#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
-// libstd/os/raw/mod.rs assures me that every libstd-supported platform has a
-// 32-bit c_int. Below is -2, in two's complement, but that only works out
-// because c_int is 32 bits.
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE))]
pub struct BorrowedFd<'fd> {
fd: RawFd,
_phantom: PhantomData<&'fd OwnedFd>,
@@ -105,17 +99,6 @@ pub struct BorrowedHandle<'handle> {
#[cfg(windows)]
#[derive(Copy, Clone)]
#[repr(transparent)]
-#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
-// This is -2, in two's complement. -1 is `INVALID_SOCKET`.
-#[cfg_attr(
- all(rustc_attrs, target_pointer_width = "32"),
- rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)
-)]
-#[cfg_attr(
- all(rustc_attrs, target_pointer_width = "64"),
- rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FF_FF_FF_FF_FE)
-)]
pub struct BorrowedSocket<'socket> {
socket: RawSocket,
_phantom: PhantomData<&'socket OwnedSocket>,
@@ -131,12 +114,6 @@ pub struct BorrowedSocket<'socket> {
/// has the value `-1`.
#[cfg(any(unix, target_os = "wasi"))]
#[repr(transparent)]
-#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
-// libstd/os/raw/mod.rs assures me that every libstd-supported platform has a
-// 32-bit c_int. Below is -2, in two's complement, but that only works out
-// because c_int is 32 bits.
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE))]
pub struct OwnedFd {
fd: RawFd,
}
@@ -286,17 +263,6 @@ impl BorrowedHandle<'_> {
/// [`INVALID_SOCKET`].
#[cfg(windows)]
#[repr(transparent)]
-#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
-// This is -2, in two's complement. -1 is `INVALID_SOCKET`.
-#[cfg_attr(
- all(rustc_attrs, target_pointer_width = "32"),
- rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)
-)]
-#[cfg_attr(
- all(rustc_attrs, target_pointer_width = "64"),
- rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FF_FF_FF_FF_FE)
-)]
pub struct OwnedSocket {
socket: RawSocket,
}
diff --git a/vendor/io-lifetimes/src/views.rs b/vendor/io-lifetimes/src/views.rs
index aec3750a0..b74a8c387 100644
--- a/vendor/io-lifetimes/src/views.rs
+++ b/vendor/io-lifetimes/src/views.rs
@@ -9,10 +9,14 @@ use crate::raw::{
AsRawFilelike, AsRawSocketlike, FromRawFilelike, FromRawSocketlike, IntoRawFilelike,
IntoRawSocketlike, RawFilelike, RawSocketlike,
};
+#[cfg(any(unix, target_os = "wasi"))]
+use crate::OwnedFd;
use crate::{
AsFilelike, AsSocketlike, FromFilelike, FromSocketlike, IntoFilelike, IntoSocketlike,
OwnedFilelike, OwnedSocketlike,
};
+#[cfg(windows)]
+use crate::{OwnedHandle, OwnedSocket};
use std::fmt;
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
@@ -202,3 +206,72 @@ impl<Target: SocketlikeViewType> fmt::Debug for SocketlikeView<'_, Target> {
.finish()
}
}
+
+#[cfg(any(unix, target_os = "wasi"))]
+unsafe impl FilelikeViewType for OwnedFd {}
+#[cfg(windows)]
+unsafe impl FilelikeViewType for OwnedHandle {}
+#[cfg(windows)]
+unsafe impl SocketlikeViewType for OwnedSocket {}
+unsafe impl FilelikeViewType for std::fs::File {}
+unsafe impl SocketlikeViewType for std::net::TcpStream {}
+unsafe impl SocketlikeViewType for std::net::TcpListener {}
+unsafe impl SocketlikeViewType for std::net::UdpSocket {}
+#[cfg(unix)]
+unsafe impl SocketlikeViewType for std::os::unix::net::UnixStream {}
+#[cfg(unix)]
+unsafe impl SocketlikeViewType for std::os::unix::net::UnixListener {}
+
+#[cfg(unix)]
+unsafe impl SocketlikeViewType for std::os::unix::net::UnixDatagram {}
+#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "os_pipe")]
+unsafe impl FilelikeViewType for os_pipe::PipeWriter {}
+#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "os_pipe")]
+unsafe impl FilelikeViewType for os_pipe::PipeReader {}
+
+#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "socket2")]
+unsafe impl SocketlikeViewType for socket2::Socket {}
+
+#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "async_std")]
+unsafe impl SocketlikeViewType for async_std::net::TcpStream {}
+#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "async_std")]
+unsafe impl SocketlikeViewType for async_std::net::TcpListener {}
+#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "async_std")]
+unsafe impl SocketlikeViewType for async_std::net::UdpSocket {}
+#[cfg(unix)]
+#[cfg(feature = "async_std")]
+unsafe impl SocketlikeViewType for async_std::os::unix::net::UnixStream {}
+#[cfg(unix)]
+#[cfg(feature = "async_std")]
+unsafe impl SocketlikeViewType for async_std::os::unix::net::UnixListener {}
+#[cfg(unix)]
+#[cfg(feature = "async_std")]
+unsafe impl SocketlikeViewType for async_std::os::unix::net::UnixDatagram {}
+
+#[cfg(feature = "mio")]
+unsafe impl SocketlikeViewType for mio::net::TcpStream {}
+#[cfg(feature = "mio")]
+unsafe impl SocketlikeViewType for mio::net::TcpListener {}
+#[cfg(feature = "mio")]
+unsafe impl SocketlikeViewType for mio::net::UdpSocket {}
+#[cfg(unix)]
+#[cfg(feature = "mio")]
+unsafe impl SocketlikeViewType for mio::net::UnixDatagram {}
+#[cfg(unix)]
+#[cfg(feature = "mio")]
+unsafe impl SocketlikeViewType for mio::net::UnixListener {}
+#[cfg(unix)]
+#[cfg(feature = "mio")]
+unsafe impl SocketlikeViewType for mio::net::UnixStream {}
+#[cfg(unix)]
+#[cfg(feature = "mio")]
+unsafe impl FilelikeViewType for mio::unix::pipe::Receiver {}
+#[cfg(unix)]
+#[cfg(feature = "mio")]
+unsafe impl FilelikeViewType for mio::unix::pipe::Sender {}
diff --git a/vendor/io-lifetimes/tests/api.rs b/vendor/io-lifetimes/tests/api.rs
deleted file mode 100644
index 19f65c440..000000000
--- a/vendor/io-lifetimes/tests/api.rs
+++ /dev/null
@@ -1,146 +0,0 @@
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg(feature = "close")]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-use io_lifetimes::raw::{AsRawFilelike, AsRawSocketlike};
-use io_lifetimes::views::{FilelikeView, SocketlikeView};
-use io_lifetimes::{
- AsFilelike, AsSocketlike, BorrowedFilelike, FromFilelike, FromSocketlike, IntoFilelike,
- IntoSocketlike,
-};
-use std::io::{Read, Write};
-
-struct Tester {}
-impl Tester {
- fn use_file<Filelike: AsFilelike>(filelike: Filelike) {
- let mut buf = Vec::new();
-
- let filelike = filelike.as_filelike();
-
- let view = filelike.as_filelike_view::<std::fs::File>();
- let _ = (&*view).read(&mut buf).is_ok();
- let _ = (&*view).write(&buf).is_ok();
-
- let view = unsafe {
- FilelikeView::<std::fs::File>::view_raw(
- filelike
- .as_filelike_view::<std::fs::File>()
- .as_raw_filelike(),
- )
- };
- let _ = (&*view).read(&mut buf).is_ok();
- let _ = (&*view).write(&buf).is_ok();
-
- let _ = dbg!(filelike);
- }
-
- fn use_socket<Socketlike: AsSocketlike>(socketlike: Socketlike) {
- let mut buf = Vec::new();
-
- let socketlike = socketlike.as_socketlike();
- let view = socketlike.as_socketlike_view::<std::net::TcpStream>();
- let _ = (&*view).read(&mut buf).is_ok();
- let _ = (&*view).write(&buf).is_ok();
-
- let view = unsafe {
- SocketlikeView::<std::net::TcpStream>::view_raw(
- socketlike
- .as_socketlike_view::<std::net::TcpStream>()
- .as_raw_socketlike(),
- )
- };
- let _ = (&*view).read(&mut buf).is_ok();
- let _ = (&*view).write(&buf).is_ok();
-
- let _ = dbg!(socketlike);
- }
-
- fn from_file<Filelike: IntoFilelike>(filelike: Filelike) {
- let mut buf = Vec::new();
-
- let filelike = filelike.into_filelike();
- let view = filelike.as_filelike_view::<std::fs::File>();
- let _ = (&*view).read(&mut buf).is_ok();
- let _ = (&*view).write(&buf).is_ok();
- drop(view);
-
- let _ = dbg!(&filelike);
- let _ = std::fs::File::from_filelike(filelike);
- }
-
- fn from_socket<Socketlike: IntoSocketlike>(socketlike: Socketlike) {
- let mut buf = Vec::new();
-
- let socketlike = socketlike.into_socketlike();
- let view = socketlike.as_socketlike_view::<std::net::TcpStream>();
- let _ = (&*view).read(&mut buf).is_ok();
- let _ = (&*view).write(&buf).is_ok();
- drop(view);
-
- let _ = dbg!(&socketlike);
- let _ = std::net::TcpStream::from_socketlike(socketlike);
- }
-
- fn from_into_file<Filelike: IntoFilelike>(filelike: Filelike) {
- let _ = std::fs::File::from_into_filelike(filelike);
- }
-
- fn from_into_socket<Socketlike: IntoSocketlike>(socketlike: Socketlike) {
- let _ = std::net::TcpStream::from_into_socketlike(socketlike);
- }
-}
-
-#[test]
-fn test_api() {
- let file = std::fs::File::open("Cargo.toml").unwrap();
- Tester::use_file(&file);
- Tester::use_file(file.as_filelike());
- Tester::use_file(&*file.as_filelike_view::<std::fs::File>());
- Tester::use_file(file.as_filelike_view::<std::fs::File>().as_filelike());
-
- let socket = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
- Tester::use_socket(&socket);
- Tester::use_socket(socket.as_socketlike());
- Tester::use_socket(&*socket.as_socketlike_view::<std::net::TcpListener>());
- Tester::use_socket(
- socket
- .as_socketlike_view::<std::net::TcpListener>()
- .as_socketlike(),
- );
-
- Tester::from_file(std::fs::File::open("Cargo.toml").unwrap().into_filelike());
- Tester::from_file(
- std::fs::File::open("Cargo.toml")
- .unwrap()
- .into_filelike()
- .into_filelike(),
- );
- Tester::from_socket(
- std::net::TcpListener::bind("127.0.0.1:0")
- .unwrap()
- .into_socketlike(),
- );
- Tester::from_socket(
- std::net::TcpListener::bind("127.0.0.1:0")
- .unwrap()
- .into_socketlike()
- .into_socketlike(),
- );
-
- Tester::from_into_file(std::fs::File::open("Cargo.toml").unwrap().into_filelike());
- Tester::from_into_socket(
- std::net::TcpListener::bind("127.0.0.1:0")
- .unwrap()
- .into_socketlike(),
- );
-}
-
-#[test]
-fn test_as() {
- let file = std::fs::File::open("Cargo.toml").unwrap();
- let borrow: BorrowedFilelike = file.as_filelike();
- let reborrow: BorrowedFilelike = borrow.as_filelike();
- let ref_reborrow: &BorrowedFilelike = &reborrow;
- let borrow_ref_reborrow: BorrowedFilelike = ref_reborrow.as_filelike();
- let _ref_borrow_ref_reborrow: &BorrowedFilelike = &borrow_ref_reborrow;
-}
diff --git a/vendor/io-lifetimes/tests/assumptions.rs b/vendor/io-lifetimes/tests/assumptions.rs
deleted file mode 100644
index 33094b653..000000000
--- a/vendor/io-lifetimes/tests/assumptions.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-
-#[cfg(any(not(windows), feature = "close"))]
-use std::mem::size_of;
-
-#[cfg(unix)]
-#[test]
-fn test_assumptions() {
- assert_eq!(size_of::<std::os::unix::io::RawFd>(), size_of::<i32>());
- assert_eq!(
- size_of::<std::os::unix::io::RawFd>(),
- size_of::<std::os::raw::c_int>()
- );
-}
-
-#[cfg(target_os = "wasi")]
-#[test]
-fn test_assumptions() {
- assert_eq!(size_of::<std::os::wasi::io::RawFd>(), size_of::<i32>());
- assert_eq!(
- size_of::<std::os::wasi::io::RawFd>(),
- size_of::<std::os::raw::c_int>()
- );
-}
-
-#[cfg(all(windows, feature = "close"))]
-#[test]
-fn test_assumptions() {
- assert_eq!(
- size_of::<std::os::windows::io::RawSocket>(),
- size_of::<windows_sys::Win32::Networking::WinSock::SOCKET>()
- );
- assert_eq!(
- size_of::<std::os::windows::io::RawHandle>(),
- size_of::<windows_sys::Win32::Foundation::HANDLE>()
- );
- assert_eq!(
- windows_sys::Win32::Networking::WinSock::INVALID_SOCKET,
- usize::MAX
- );
- assert_ne!(
- windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE,
- std::ptr::null_mut() as std::os::windows::io::RawHandle as _
- );
-}
diff --git a/vendor/io-lifetimes/tests/ffi.rs b/vendor/io-lifetimes/tests/ffi.rs
deleted file mode 100644
index af03efe05..000000000
--- a/vendor/io-lifetimes/tests/ffi.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-#![cfg_attr(not(rustc_attrs), allow(unused_imports))]
-#![cfg(feature = "close")]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-#[cfg(any(unix, windows))]
-use io_lifetimes::example_ffi::*;
-#[cfg(windows)]
-use io_lifetimes::{InvalidHandleError, OwnedHandle};
-#[cfg(windows)]
-use std::{convert::TryInto, os::windows::io::RawHandle, ptr::null_mut};
-#[cfg(windows)]
-use windows_sys::Win32::Storage::FileSystem::{
- FILE_ATTRIBUTE_NORMAL, FILE_GENERIC_READ, OPEN_EXISTING,
-};
-
-#[cfg(all(rustc_attrs, unix))]
-#[test]
-fn test_file_not_found() {
- assert!(unsafe {
- open(
- "/dev/no/such/file\0".as_ptr() as *const _,
- O_RDONLY | O_CLOEXEC,
- )
- }
- .is_none());
-}
-
-#[cfg(windows)]
-#[test]
-fn test_file_not_found() {
- let handle: Result<OwnedHandle, InvalidHandleError> = unsafe {
- CreateFileW(
- [
- 'C' as u16, ':' as _, '/' as _, 'n' as _, 'o' as _, '/' as _, 's' as _, 'u' as _,
- 'c' as _, 'h' as _, '/' as _, 'f' as _, 'i' as _, 'l' as _, 'e' as _, 0,
- ]
- .as_ptr(),
- FILE_GENERIC_READ,
- 0,
- null_mut(),
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- null_mut() as RawHandle as HANDLE,
- )
- }
- .try_into();
- assert!(handle.is_err());
- assert_eq!(
- std::io::Error::last_os_error().kind(),
- std::io::ErrorKind::NotFound
- );
-}
-
-#[cfg(all(rustc_attrs, unix))]
-#[test]
-fn test_file_found() {
- assert!(unsafe { open("Cargo.toml\0".as_ptr() as *const _, O_RDONLY | O_CLOEXEC) }.is_some());
-}
-
-#[cfg(windows)]
-#[test]
-fn test_file_found() {
- let handle: Result<OwnedHandle, InvalidHandleError> = unsafe {
- CreateFileW(
- [
- 'C' as u16, 'a' as _, 'r' as _, 'g' as _, 'o' as _, '.' as _, 't' as _, 'o' as _,
- 'm' as _, 'l' as _, 0,
- ]
- .as_ptr(),
- FILE_GENERIC_READ,
- 0,
- null_mut(),
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- null_mut() as RawHandle as HANDLE,
- )
- }
- .try_into();
- assert!(handle.is_ok());
-}
diff --git a/vendor/io-lifetimes/tests/niche-optimizations.rs b/vendor/io-lifetimes/tests/niche-optimizations.rs
deleted file mode 100644
index 89316d559..000000000
--- a/vendor/io-lifetimes/tests/niche-optimizations.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-#![cfg_attr(not(rustc_attrs), allow(unused_imports))]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-use std::mem::size_of;
-
-#[cfg(any(unix, target_os = "wasi"))]
-use io_lifetimes::{BorrowedFd, OwnedFd};
-#[cfg(windows)]
-use io_lifetimes::{BorrowedSocket, OwnedSocket};
-
-#[cfg(unix)]
-use std::os::unix::io::{FromRawFd, IntoRawFd, RawFd};
-#[cfg(target_os = "wasi")]
-use std::os::wasi::io::{FromRawSocket, IntoRawSocket, RawFd};
-#[cfg(windows)]
-use std::os::windows::io::{FromRawSocket, IntoRawSocket, RawSocket};
-
-#[cfg(all(rustc_attrs, any(unix, target_os = "wasi")))]
-#[test]
-fn test_niche_optimizations() {
- assert_eq!(size_of::<Option<OwnedFd>>(), size_of::<RawFd>());
- assert_eq!(size_of::<Option<BorrowedFd<'static>>>(), size_of::<RawFd>());
- unsafe {
- assert_eq!(OwnedFd::from_raw_fd(RawFd::MIN).into_raw_fd(), RawFd::MIN);
- assert_eq!(OwnedFd::from_raw_fd(RawFd::MAX).into_raw_fd(), RawFd::MAX);
- assert_eq!(
- Some(OwnedFd::from_raw_fd(RawFd::MIN))
- .unwrap()
- .into_raw_fd(),
- RawFd::MIN
- );
- assert_eq!(
- Some(OwnedFd::from_raw_fd(RawFd::MAX))
- .unwrap()
- .into_raw_fd(),
- RawFd::MAX
- );
- }
-}
-
-#[cfg(all(rustc_attrs, windows))]
-#[test]
-fn test_niche_optimizations_socket() {
- assert_eq!(size_of::<Option<OwnedSocket>>(), size_of::<RawSocket>());
- assert_eq!(
- size_of::<Option<BorrowedSocket<'static>>>(),
- size_of::<RawSocket>(),
- );
- unsafe {
- #[cfg(target_pointer_width = "32")]
- let (min, max) = (i32::MIN as u32, i32::MAX as u32);
- #[cfg(target_pointer_width = "64")]
- let (min, max) = (i64::MIN as u64, i64::MAX as u64);
-
- assert_eq!(OwnedSocket::from_raw_socket(min).into_raw_socket(), min);
- assert_eq!(OwnedSocket::from_raw_socket(max).into_raw_socket(), max);
- assert_eq!(
- Some(OwnedSocket::from_raw_socket(min))
- .unwrap()
- .into_raw_socket(),
- min
- );
- assert_eq!(
- Some(OwnedSocket::from_raw_socket(max))
- .unwrap()
- .into_raw_socket(),
- max
- );
- }
-}