ability to implicitly cast integer literal to &const Int

where Int is an integer type

also introduce `@intToPtr` builtin for converting a usize
to a pointer. users now have to use this instead of `(&T)(int)`.

closes #311
This commit is contained in:
Andrew Kelley
2017-04-07 15:34:13 -04:00
parent ffb4852012
commit f7e9d7aa5d
8 changed files with 116 additions and 101 deletions

View File

@@ -68,7 +68,7 @@ pub fn writeStackTrace(out_stream: &io.OutStream) -> %void {
var maybe_fp: ?&const u8 = @frameAddress();
while (true) {
const fp = maybe_fp ?? break;
const return_address = *(&const usize)(usize(fp) + @sizeOf(usize));
const return_address = *@intToPtr(&const usize, usize(fp) + @sizeOf(usize));
const compile_unit = findCompileUnit(st, return_address) ?? return error.MissingDebugInfo;
const name = %return compile_unit.die.getAttrString(st, DW.AT_name);