-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add specialization of ToString for char
#73465
Conversation
Hm, this is an interesting case where AFAIK, there's no way to know this impl exists other than performance. I'm inclined to say it doesn't need FCP then. @rust-lang/libs, what do you think? @lzutao Have you checked that this fixes the associated issue? Or we're just assuming it should? |
Is the prohibition on new specializations still in effect? |
Cc @matthewjasper @nikomatsakis I think this is just expanding an existing specialization-available trait so we probably don't need to worry too much? |
I'm fine with this specialization being added. We use |
r=me assuming there aren't any objections on the specialization. |
Yes. The assembly code after this PR: check_stage1::foo:
push rbx
mov rbx, rdi
mov edi, 1
mov esi, 1
call qword, ptr, [rip, +, __rust_alloc@GOTPCREL]
test rax, rax
je .LBB1_1
mov byte, ptr, [rax], 97
mov qword, ptr, [rbx], rax
movaps xmm0, xmmword, ptr, [rip, +, .LCPI1_0]
movups xmmword, ptr, [rbx, +, 8], xmm0
mov rax, rbx
pop rbx
ret
.LBB1_1:
mov edi, 1
mov esi, 1
call alloc::raw_vec::RawVec<T,A>::allocate_in::{{closure}}
ud2 where: pub fn foo() -> String {
'a'.to_string()
} |
|
@bors r=sfackler per @matthewjasper's approval here. It also seems like we can easily revert this down the line if needed. |
📌 Commit e5c5df8 has been approved by |
Add specialization of `ToString for char` Closes rust-lang#73462
…arth Rollup of 13 pull requests Successful merges: - rust-lang#71568 (Document unsafety in slice/sort.rs) - rust-lang#72709 (`#[deny(unsafe_op_in_unsafe_fn)]` in liballoc) - rust-lang#73214 (Add asm!() support for hexagon) - rust-lang#73248 (save_analysis: improve handling of enum struct variant) - rust-lang#73257 (ty: projections in `transparent_newtype_field`) - rust-lang#73261 (Suggest `?Sized` when applicable for ADTs) - rust-lang#73300 (Implement crate-level-only lints checking.) - rust-lang#73334 (Note numeric literals that can never fit in an expected type) - rust-lang#73357 (Use `LocalDefId` for import IDs in trait map) - rust-lang#73364 (asm: Allow multiple template string arguments; interpret them as newline-separated) - rust-lang#73382 (Only display other method receiver candidates if they actually apply) - rust-lang#73465 (Add specialization of `ToString for char`) - rust-lang#73489 (Refactor hir::Place) Failed merges: r? @ghost
Closes #73462