From 9746b05da995629780f559e68cde2a3d41b3b2bc Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 18 Jan 2020 13:12:30 +0100 Subject: [PATCH] clean up e0200 explanation --- src/librustc_error_codes/error_codes/E0200.md | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0200.md b/src/librustc_error_codes/error_codes/E0200.md index 865e91430ac4..7245bb59ce5f 100644 --- a/src/librustc_error_codes/error_codes/E0200.md +++ b/src/librustc_error_codes/error_codes/E0200.md @@ -1,14 +1,23 @@ -Unsafe traits must have unsafe implementations. This error occurs when an -implementation for an unsafe trait isn't marked as unsafe. This may be resolved -by marking the unsafe implementation as unsafe. +An unsafe trait was implemented without an unsafe implementation. + +Erroneous code example: ```compile_fail,E0200 struct Foo; unsafe trait Bar { } -// this won't compile because Bar is unsafe and impl isn't unsafe -impl Bar for Foo { } -// this will compile -unsafe impl Bar for Foo { } +impl Bar for Foo { } // error! +``` + +Unsafe traits must have unsafe implementations. This error occurs when an +implementation for an unsafe trait isn't marked as unsafe. This may be resolved +by marking the unsafe implementation as unsafe. + +``` +struct Foo; + +unsafe trait Bar { } + +unsafe impl Bar for Foo { } // ok! ```