diff options
| author | 2026-10-15 11:29:26 +0330 | |
|---|---|---|
| committer | 2026-10-15 11:29:26 +0330 | |
| commit | a3f769ea02b5686084c5b3c2a382b9934b535050 (patch) | |
| tree | 47caed7e1bc49dbb9ee7aecd76f88c2048963f21 /tests/errors/borrows_extern.zc | |
| parent | merge work/stdio: std.Io and one-level module completion (diff) | |
| parent | xref: baseline records the borrow globals (end_why, end_whom, arg_site, local... (diff) | |
merge work/borrow: borrow returns before definition, borrows clause, borrow messages and LSP diagnostics, mkgenome header mismatch values
Diffstat (limited to 'tests/errors/borrows_extern.zc')
| -rw-r--r-- | tests/errors/borrows_extern.zc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/errors/borrows_extern.zc b/tests/errors/borrows_extern.zc new file mode 100644 index 0000000..e9285d4 --- /dev/null +++ b/tests/errors/borrows_extern.zc @@ -0,0 +1,11 @@ +namespace; +include rt; + +// expect: r: used after it was given away; r borrows t, and t was freed on line 9 (t declared on line 8) +// an extern declares its borrow return by parameter position. +extern char* strchr(char*, int) borrows 0; +fn main() { + char* t = rt.new(4); t[0] = 'x'; t[1] = 0; + let r = strchr(t, 'x'); rt.free(t); rt.put_c(r[0]); + return 0; +} |
