-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
compare the following disassemblies:
#![allow(dead_code)]
use std::path::{Path, PathBuf};
#[no_mangle]
pub fn boxed_path() -> Box<Path> {
Path::new("aaa").into()
}
boxed_path:
lea rdi, [rip + .L__unnamed_1]
mov esi, 3
jmp qword ptr [rip + std::path::<impl core::convert::From<&std::path::Path> for alloc::boxed::Box<std::path::Path>>::from::hfd2d6fbd02ea1491@GOTPCREL]
.L__unnamed_1:
.zero 3,97
#![allow(dead_code)]
use std::path::{Path, PathBuf};
#[no_mangle]
pub fn boxed_path() -> Box<Path> {
PathBuf::from("aaa").into()
}
boxed_path:
push rbx
sub rsp, 32
lea rsi, [rip + .L__unnamed_1]
lea rbx, [rsp + 8]
mov edx, 3
mov rdi, rbx
call qword ptr [rip + std::sys::os_str::bytes::Slice::to_owned::hda0e6bb365f52f1f@GOTPCREL]
mov rdi, rbx
call qword ptr [rip + std::ffi::os_str::OsString::into_boxed_os_str::haa190229882bb506@GOTPCREL]
add rsp, 32
pop rbx
ret
.L__unnamed_1:
.zero 3,97
Metadata
Metadata
Assignees
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.