mozilla/rust — Issue #1807: Cannot declare unsafe impl functions
Author: erickt
Created: 2012-02-10 18:21:10+00:00
State: open

I would expect that interfaces and implementations would support declaring a function as unsafe but it doesn't seem to work:

impl foo for [u8] {
unsafe fn from_bytes() -> str { str::unsafe::from_bytes(self) }
}

fn main() {}

Errors out with this:

test.rs:2:4: 2:10 error: expecting fn, found unsafe
test.rs:2 unsafe fn from_bytes() -> str {
^~~~~~