빌드 전체가 한 모듈이라 파일 이름도 하나였다. std.list 안에서 터진 경계 검사가 프로그램의 파일 이름을 대고 있었으니, 줄 번호는 맞는데 파일이 틀려서 엉뚱한 줄을 가리켰다 -- 이름을 안 대는 것보다 나쁘다. 모듈이 파일 표를 들고 트랩은 그 인덱스를 든다. 생성기는 파일마다 FE_FILE_n 을 한 번씩 찍는다. before: index out of bounds at main.fe:2 after: index out of bounds at pick.fe:6 그리고 Parser.on 이 구조체 리터럴 안에서 다시 try 를 쓴다. 앞서 그것이 깨졌던 것은 try 때문이 아니라 Parser 가 1 바이트로 자리잡았기 때문이었다. 224/224, 31/31.
21 lines
484 B
Plaintext
21 lines
484 B
Plaintext
// EXIT:3
|
|
// OUTPUT:index out of bounds
|
|
// OUTPUT:pick.fe:6
|
|
// NOCHECKS:0
|
|
unit main;
|
|
|
|
import pick;
|
|
|
|
// A build is many units in one module. A trap has to name the file the check
|
|
// was written in, not the file the program was started from.
|
|
|
|
const S: str = "abc";
|
|
|
|
fn main() -> i32 {
|
|
let c: u8 = pick.at(S, 9);
|
|
// Without the checks the read runs off the end and `c` is whatever
|
|
// was there, so nothing is decided by its value.
|
|
if c == 0 { return 0; }
|
|
return 0;
|
|
}
|