summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0197.md
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0197.md')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0197.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0197.md b/compiler/rustc_error_codes/src/error_codes/E0197.md
new file mode 100644
index 000000000..c142b8f36
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0197.md
@@ -0,0 +1,20 @@
+An inherent implementation was marked unsafe.
+
+Erroneous code example:
+
+```compile_fail,E0197
+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.
+
+```
+struct Foo;
+
+impl Foo { } // ok!
+```