Within this `Iterator` implementation, a function `unsafe_get` is
defined which unsafely allows _unchecked_ indexing of any element in a
slice. This should be marked as _unsafe_, but it is not.
To address this issue, I removed that inner function.
Upgrade LLVM to trunk, still version 8
This commit upgrades the LLVM/LLD/compiler-rt submodules used to the current trunk versions in upstream. Some activity has happened on the wasm SIMD side of things as well as LLD which we'd like to pick up!
Make `ParseIntError` and `IntErrorKind` fully public
Why would you write nice error types if I can't read them?
# Why
It can be useful to use `match` with errors produced when parsing strings to int. This would be useful for the `.err_match()` function in my [new crate](https://crates.io/crates/read_input).
---
I could also do this for `ParseFloatError` if people think it is a good idea.
I am new around hear so please tell me if I am getting anything wrong.
Try to make top-level Cargo.toml work without __CARGO_TEST_ROOT.
The last failures I noticed before adding the `__CARGO_TEST_ROOT` hack were in `src/test/run-make/thumb-none-{cortex-m,qemu}`, and had to do with the fact that the top-level `Cargo.toml` uses nightly Cargo features.
If that's the only problem, this PR should work, and we can figure out how to unbreak RLS.
`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists,
but not needing to dereference makes type inference easier
for example when using `u32::from_be_bytes`.
Also add doc examples doing just that.
Implement checked_add_duration for SystemTime
[Original discussion on the rust user forum](https://users.rust-lang.org/t/std-systemtime-misses-a-checked-add-function/21785)
Since `SystemTime` is opaque there is no way to check if the result of an addition will be in bounds. That makes the `Add<Duration>` trait completely unusable with untrusted data. This is a big problem because adding a `Duration` to `UNIX_EPOCH` is the standard way of constructing a `SystemTime` from a unix timestamp.
This PR implements `checked_add_duration(&self, &Duration) -> Option<SystemTime>` for `std::time::SystemTime` and as a prerequisite also for all platform specific time structs. This also led to the refactoring of many `add_duration(&self, &Duration) -> SystemTime` functions to avoid redundancy (they now unwrap the result of `checked_add_duration`).
Some basic unit tests for the newly introduced function were added too.
I wasn't sure which stabilization attribute to add to the newly introduced function, so I just chose `#[stable(feature = "time_checked_add", since = "1.32.0")]` for now to make it compile. Please let me know how I should change it or if I violated any other conventions.
P.S.: I could only test on Linux so far, so I don't necessarily expect it to compile for all platforms.
read_c_str should call the AllocationExtra hooks
I just hope we do not have other methods that bypass `get_bytes`/`get_bytes_mut`... (looking over the file, I could not find any)
r? @oli-obk