rust/src
Ulrik Sverdrup 876c02cc1a cstring: avoid excessive growth just to 0-terminate
Based on following what happens in CString::new("string literal"):

1. Using `Into<Vec<u8>>`, a Vec is allocated with capacity exactly equal
   to the string's input length.
2. By `v.push(0)`, the Vec is grown to twice capacity, since it was full.
3. By `v.into_boxed_slice()`, the Vec capacity is shrunk to fit the length again.

If we use `.reserve_exact(1)` just before the push, then we avoid the
capacity doubling that we're going to have to shrink anyway.

Growing by just 1 byte means that the step (2) is less likely to have to
move the memory to a larger allocation chunk, and that the step (3) does
not have to reallocate.
2016-08-21 13:37:33 +02:00
..
bootstrap Auto merge of #35666 - eddyb:rollup, r=eddyb 2016-08-14 15:27:15 -07:00
build_helper
compiler-rt@8598065bd9 Update compiler-rt 2016-07-29 10:29:44 +02:00
doc Rollup merge of #35647 - ahmedcharles:spelling, r=alexcrichton 2016-08-14 20:29:53 +03:00
driver
etc Auto merge of #35163 - sanxiyn:rollup, r=sanxiyn 2016-08-01 08:57:32 -07:00
grammar
jemalloc@e058ca6616
liballoc Fix a couple of typos in RawVec 2016-08-14 06:59:43 +02:00
liballoc_jemalloc arm-musl targets now use cfg(env = "musl") 2016-07-30 15:39:13 -05:00
liballoc_system
libarena
libbacktrace
libcollections Rollup merge of #35598 - tshepang:needless-binding, r=steveklabnik 2016-08-14 20:29:50 +03:00
libcollectionstest Introduce as_mut_slice method on std::vec::IntoIter struct. 2016-08-11 16:49:01 -04:00
libcore Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
libcoretest Don't gate methods Fn(Mut,Once)::call(mut,once) with feature unboxed_closures 2016-07-31 17:48:20 +03:00
libflate Update gcc crate dependency to 0.3.27. 2016-07-30 15:39:13 -05:00
libfmt_macros
libgetopts
libgraphviz
liblibc@5066b7dcab point the libc submodule back to rust-lang/libc 2016-07-30 15:39:13 -05:00
liblog
libpanic_abort
libpanic_unwind Auto merge of #35032 - vadimcn:rusty-ehabi, r=alexcrichton 2016-07-29 20:29:43 -07:00
librand
librbml
librustc Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_back Print Rust target name, not LLVM target name, for --print target-list 2016-08-08 19:22:57 +09:00
librustc_bitflags
librustc_borrowck Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_const_eval Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_const_math Update wording on E0080 2016-08-04 07:31:06 +05:30
librustc_data_structures generalize BitMatrix to be NxM and not just NxN 2016-08-09 08:26:06 -04:00
librustc_driver Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_errors Turn on new errors, json mode. Remove duplicate unicode test 2016-08-07 07:46:49 -07:00
librustc_incremental Save dep-tracking hash of commandline arguments in dep-graph file. 2016-08-11 09:56:00 -04:00
librustc_lint Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_llvm Merge branch 'master' into issue-30961 2016-08-06 15:50:48 +10:00
librustc_metadata Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_mir Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_passes Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_platform_intrinsics
librustc_plugin Remove the 'cfg' field from session::config::Options. 2016-08-11 09:56:00 -04:00
librustc_privacy Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_resolve Rollup merge of #35596 - crypto-universe:E0254_style_and_tests, r=jonathandturner 2016-08-14 20:29:50 +03:00
librustc_save_analysis Remove obsolete divergence related stuff 2016-08-13 21:37:09 +08:00
librustc_trans Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_typeck Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
librustc_unicode Auto merge of #34485 - tbu-:pr_unicode_debug_str, r=alexcrichton 2016-07-28 11:20:33 -07:00
librustdoc Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
libserialize
libstd cstring: avoid excessive growth just to 0-terminate 2016-08-21 13:37:33 +02:00
libsyntax Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
libsyntax_ext Rollup merge of #35106 - xen0n:issue-35082, r=alexcrichton 2016-07-30 13:44:47 +05:30
libsyntax_pos Rollup merge of #35094 - mcarton:multispan, r=jonathandturner 2016-07-30 13:44:47 +05:30
libterm
libtest Auto merge of #35414 - jupp0r:feature/test-threads-flag, r=alexcrichton 2016-08-13 09:52:49 -07:00
libunwind [emscripten] Disable code paths that don't work on emscripten 2016-08-10 16:39:32 +02:00
llvm@786aad117b Improved checking of target's llvm_config 2016-08-10 22:24:51 +10:00
rt
rtstartup
rust-installer@c37d3747da
rustc Update gcc crate dependency to 0.3.27. 2016-07-30 15:39:13 -05:00
rustllvm Improved checking of target's llvm_config 2016-08-10 22:24:51 +10:00
test Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis 2016-08-16 00:12:12 -07:00
tools Auto merge of #35340 - michaelwoerister:incr-comp-cli-args, r=nikomatsakis 2016-08-15 08:35:18 -07:00
stage0.txt