about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-11 22:28:24 -0700
committerGitHub <noreply@github.com>2016-09-11 22:28:24 -0700
commit4d9132357fce86c772a9101a0df8aa4261904ac7 (patch)
tree0402761b3a3f402745e4d875873cbe12071a07ef /src/rustllvm/RustWrapper.cpp
parent0f5f325f9ad05a3ce3d2663bd6d1163bf288de9f (diff)
parent765700ba7a3743b9af5cb12092ea1293dbe07068 (diff)
downloadrust-4d9132357fce86c772a9101a0df8aa4261904ac7.tar.gz
rust-4d9132357fce86c772a9101a0df8aa4261904ac7.zip
Auto merge of #36355 - bluss:vec-extend-from-slice-aliasing-workaround, r=alexcrichton
Work around pointer aliasing issue in Vec::extend_from_slice, extend_with_element

Due to missing noalias annotations for &mut T in general (issue #31681),
in larger programs extend_from_slice and extend_with_element may both
compile very poorly. What is observed is that the .set_len() calls are
not lifted out of the loop, even for `Vec<u8>`.

Use a local length variable for the Vec length instead, and use a scope
guard to write this value back to self.len when the scope ends or on
panic. Then the alias analysis is easy.

This affects extend_from_slice, extend_with_element, the vec![x; n]
macro, Write impls for Vec<u8>, BufWriter, etc (but may / may not
have triggered since inlining can be enough for the compiler to get it right).

Fixes #32155
Fixes #33518
Closes #17844
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions