007 reject dangling slice

✓ Passing Passing: the compiler rejects this program as expected.

Code

input.kz

Actual compiler output

error[KORU095]: tor 'peek' returns a borrow of its parameter 's' (`s.data`) — borrows flow down, never up; a `-> string` return must own what it carries
  --> tests/regression/600_STDLIB/610_STRING/610_007_reject_dangling_slice/input.kz:12:0
    |
 12 | 
    | ^
  hint: copy it into an owned String and return the handle (*String<view!>), or take the handle at the consumer instead of reading (610_007)

Frontend must reject with:

CONTAINS error[KORU095]
CONTAINS borrow

Test Configuration

MUST_ERROR