blob: e9285d44946e25bb9833e4585034f757b1f9a171 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
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;
}
|