* Fix 24049 - std.conv.to: string to enum conversion is not documented
* Update std/conv.d
Co-authored-by: Max Haughton <maxhaton@gmail.com>
---------
Co-authored-by: Max Haughton <maxhaton@gmail.com>
Production experience as well as synthetic tests have shown that std.json's use of associative arrays combined with GC issues causes heavy heap fragmentation. Furthermore, its heavy GC usage makes it unperformant in a threaded environment.
Despite this, people keep using std.json for production workloads, then being disappointed when it doesn't measure up. So let's warn them upfront.
Rebindable2 is a simplified version of std.typecons.Rebindable that clears up every special case: classes, arrays and structs now have the same struct.
Whichever type you instantiate `Rebindable2` with, you always get the same type out by calling `value.get` on the resulting container.
Also use this type to simplify the parts of Phobos we previously used `Rebindable` for.
When using `absolutePath` with 'priview=in' enabled,
it requires to duplicate value to be able to call this function.
Within this commit the signature of `absolutePath` function
is changed from `string absolutePath(string path, lazy string base = getcwd())`
to `string absolutePath(return scope const string path, lazy string base = getcwd())`
thus, after this commit it is possible to use this func in scope context.
Example case:
```d
/+ dub.sdl:
name "dub-example"
dflags "-preview=in" "-preview=dip1000"
+/
import std.stdio;
import std.path;
@safe:
string fun(in string path) {
return path.absolutePath;
}
void main() {
string p = fun("~/tests/1");
writefln("P: %s", p);
}
```
* typecons: fix use-after-scope bug in RefCounted unittest
The access through `p` to `rc1` outside the scope of `rc1` is undefined behavior. We have to artificially end the scope of `rc1` and `rc2`, such that within the same scope we can check that the destructor calls do the correct thing of nulling the `_store`.
* fixup
* fixup
When using `expandTilde` with 'priview=in' enabled,
it requires to duplicate value to be able to call this function.
Within this commit the signature of expandTilde function is
changed from `string expandTilde(string inputPath) @safe nothrow`
to `string expandTilde(return scope const string inputPath) @safe nothrow`
thus, after this commit it is possible to use this func in scope
context.
Example case:
```d
/+ dub.sdl:
name "dub-example"
dflags "-preview=in" "-preview=dip1000"
+/
import std.stdio;
import std.path;
@safe:
string fun(in string path) {
return path.expandTilde;
}
void main() {
string p = fun("~/tests/1");
writefln("P: %s", p);
}
```
`only` is a range that may be *mutable*, but not *assignable*. `chain` falls over here because it assumes it can make a struct with ranges, and reassign them with new values, which isn't necessarily the case even if the ranges are not `const`.
Solved by creating a separate tuple of `Rebindable` ranges for this case.