]> git.lizzy.rs Git - rust.git/commit
auto merge of #15493 : brson/rust/tostr, r=pcwalton
authorbors <bors@rust-lang.org>
Tue, 8 Jul 2014 20:06:40 +0000 (20:06 +0000)
committerbors <bors@rust-lang.org>
Tue, 8 Jul 2014 20:06:40 +0000 (20:06 +0000)
commit8bb34a3146e6ba4bc7902a85de90cf4f8064ace0
treef5dd9ae1066eb755649fcced85e998d72147de19
parent35e21346216cc4c5a3b22bb6fb316f8c867f8c92
parent12c334a77b897f7b1cb6cff3c56a71ecb89c82af
auto merge of #15493 : brson/rust/tostr, r=pcwalton

This updates https://github.com/rust-lang/rust/pull/15075.

Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unify `to_string` and address performance for all `to_string` conversions in `core::fmt`. `String::from_str(...)` still works as a manual fast-path.

Note that the patch was done with a script, and ended up renaming a number of other `*_to_str` functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage.

Closes #15046.
src/librustc/metadata/decoder.rs
src/librustc/metadata/encoder.rs
src/librustc/middle/resolve.rs
src/librustc/middle/typeck/collect.rs
src/librustc/middle/typeck/infer/error_reporting.rs
src/libsyntax/ast.rs
src/libsyntax/fold.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs