File: net_bind_resource.rs

package info (click to toggle)
rust-tokio 1.48.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,444 kB
  • sloc: makefile: 2
file content (14 lines) | stat: -rw-r--r-- 439 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery or bind

use tokio::net::TcpListener;

use std::net;

#[test]
#[should_panic]
#[cfg_attr(miri, ignore)] // No `socket` in miri.
fn no_runtime_panics_binding_net_tcp_listener() {
    let listener = net::TcpListener::bind("127.0.0.1:0").expect("failed to bind listener");
    let _ = TcpListener::try_from(listener);
}