rust/library/std
Matthias Krüger 02134611ce
Rollup merge of #111057 - xfix:tcpstream-as-raw-fd-inline, r=m-ou-se
Make sure the implementation of TcpStream::as_raw_fd is fully inlined

Currently the following function:

```rust
use std::os::fd::{AsRawFd, RawFd};
use std::net::TcpStream;

pub fn as_raw_fd(socket: &TcpStream) -> RawFd {
    socket.as_raw_fd()
}
```

Is optimized to the following:

```asm
example::as_raw_fd:
        push    rax
        call    qword ptr [rip + <std::net::tcp::TcpStream as std::sys_common::AsInner<std::sys_common::net::TcpStream>>::as_inner@GOTPCREL]
        mov     rdi, rax
        call    qword ptr [rip + std::sys_common::net::TcpStream::socket@GOTPCREL]
        mov     rdi, rax
        pop     rax
        jmp     qword ptr [rip + _ZN73_$LT$std..sys..unix..net..Socket$u20$as$u20$std..os..fd..raw..AsRawFd$GT$9as_raw_fd17h633bcf7e481df8bbE@GOTPCREL]
```

I think it would make more sense to inline trivial functions used within `TcpStream::AsRawFd`.
2023-05-01 17:10:25 +02:00
..
benches
primitive_docs
src Rollup merge of #111057 - xfix:tcpstream-as-raw-fd-inline, r=m-ou-se 2023-05-01 17:10:25 +02:00
tests Exclude SGX from create_dir_all_bare test 2023-02-21 18:33:20 +00:00
build.rs socket ancillary data implementation for FreeBSD (from 13 and above). 2023-03-27 16:48:41 +01:00
Cargo.toml Auto merge of #110562 - ComputerDruid:riscv, r=tmandry 2023-04-27 01:29:50 +00:00