Rikki's Borrow Checker

Nick Treleaven nick at geany.org
Sat Aug 29 09:21:21 UTC 2026


On Thursday, 27 August 2026 at 20:35:04 UTC, Walter Bright wrote:
> https://github.com/dlang/dmd/pull/23572
>
> Give it a whirl, and let us know what you think!

Looks good so far, but there may be some issues.

Using the Buffer struct from the [changelog 
item](https://dlang.org/changelog/pending.html#dmd.fastdfa.borrowchecker):

```d
import std.stdio;

void test() {
     Buffer s;
     int* c = s.get();
     call(s, c); // error, owner of active borrow may be mutated
     borrow(c); // same error, but no owner is passed and 
parameter is scope

     s = s.init; // no error
     destroy(s); // no error
     writeln(*c);
}

void call(ref const Buffer, scope int*); // but Buffer is const!
void borrow(scope int*);
```

Error also happens without `call`'s `ref` parameter.


More information about the Digitalmars-d mailing list