D-Programming-Language/druntime — pull request #621 by denis-sh (2013-10-02 10:59:44+00:00)
Title: Mark `malloc`, `calloc`, and `alloca` `@trusted`.

The fact one has to do a pointer cast with the result doesn't mean allocation operation itself is `@system` i.e. can exhibit undefined behavior.

Example:
```D
auto f(alias alloc)() // `alloc` is e.g. `malloc`
{
void* p = alloc(12); // `f` attributes are inferred based on `alloc`
if(!p) onOutOfMemoryError();
int[] arr = () @trusted => (cast(int*) p)[0 .. 3];
// some `@safe` stuff here
}
```