about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-04-06 14:20:22 -0700
committerAlex Crichton <alex@alexcrichton.com>2018-04-13 07:04:24 -0700
commit2bb5b5c07c5cd015c567ce86eae07e92db07bb8a (patch)
treef3e7610018b5e4b9085c42d62fe374b175f4e878 /src/rustllvm/RustWrapper.cpp
parent66c5e3ffb2b7a0804ceb989b9dc9138a7758bfd6 (diff)
downloadrust-2bb5b5c07c5cd015c567ce86eae07e92db07bb8a.tar.gz
rust-2bb5b5c07c5cd015c567ce86eae07e92db07bb8a.zip
core: Remove an implicit panic from Formatter::pad
The expression `&s[..i]` in general can panic if `i` is out of bounds or not on
a character boundary for a string, and this caused the codegen for
`Formatter::pad` to be a bit larger than it otherwise needed to be. This commit
replaces this with `s.get(..i).unwrap_or(&s)` which while having different
behavior if `i` is out of bounds has a much smaller code footprint and otherwise
avoids the need for `unsafe` code.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions