This was bothering me (and some other people). The macro was necessary in a transient step of my development, but I converged on a design where it was unnecessary, but it didn't really click that that had happened.
This fixes it up.
This implements `Add` and `Sub` for `Timespec`, which enables `Timespec` to be used as a time span. For example:
```rust
let begin = get_time();
// Do some stuff.
let end = get_time();
let delta = end - begin;
println!("Doing stuff took {}.{:09d} seconds.", delta.sec, delta.nsec);
```
This resolves one of the points mentioned in #2153.
First commit enables regex test on Windows. It was not working at some point (#13725), but it works now.
Second commit removes various FIXMEs regarding #13793, since upstream bug has been fixed.
This is enough for dynamic libraries, but not executables because MinGW
does not output a .reloc section even with `--dynamicbase`. It could
either be worked around by exporting a DLL symbol from the executable or
fixed in MinGW itself.
This is enough for dynamic libraries, but not executables because MinGW
does not output a .reloc section even with `--dynamicbase`. It could
either be worked around by exporting a DLL symbol from the executable or
fixed in MinGW itself.
Pretty self-explanatory. Only annoying thing is that it *seems* that I had to add `#![feature(default_type_params)]` to libnum because of Hasher. Don't know if there's a way around that.
Fix#16551
This is very half-baked at the moment and very inefficient, e.g.
inappropriate use of by-value `self` (and thus being forced into an
overuse of `clone`). People get the wrong impression about Rust when
using it, e.g. that Rust cannot express what other languages can because
the implementation is inefficient: https://news.ycombinator.com/item?id=8187831 .
The first commit improves code generation through a few changes:
- The `#[inline]` attributes allow llvm to constant fold the encoding step away in certain situations. For example, code like this changes from a call to `encode_utf8` in a inner loop to the pushing of a byte constant:
```rust
let mut s = String::new();
for _ in range(0u, 21) {
s.push_char('a');
}
```
- Both methods changed their semantic from causing run time failure if the target buffer is not large enough to returning `None` instead. This makes llvm no longer emit code for causing failure for these methods.
- A few debug `assert!()` calls got removed because they affected code generation due to unwinding, and where basically unnecessary with today's sound handling of `char` as a Unicode scalar value.
~~The second commit is optional. It changes the methods from regular indexing with the `dst[i]` syntax to unsafe indexing with `dst.unsafe_mut_ref(i)`. This does not change code generation directly - in both cases llvm is smart enough to see that there can never be an out-of-bounds access. But it makes it emit a `nounwind` attribute for the function.
However, I'm not sure whether that is a real improvement, so if there is any objection to this I'll remove the commit.~~
This changes how the methods behave on a too small buffer, so this is a
[breaking-change]