W3cubDocs

/Rust

Error code E0197

An inherent implementation was marked unsafe.

Erroneous code example:

#![allow(unused)]
fn main() {
struct Foo;

unsafe impl Foo { } // error!
}

Inherent implementations (one that do not implement a trait but provide methods associated with a type) are always safe because they are not implementing an unsafe trait. Removing the unsafe keyword from the inherent implementation will resolve this error.

#![allow(unused)]
fn main() {
struct Foo;

impl Foo { } // ok!
}

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0197.html