Skip to content

Commit 2a12ef8

Browse files
authored
Rollup merge of #68340 - GuillaumeGomez:clean-up-e0200, r=Dylan-DPC
clean up e0200 explanation r? @Dylan-DPC
2 parents 36e58ea + 9746b05 commit 2a12ef8

File tree

1 file changed

+14
-5
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+14
-5
lines changed
+14-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1+
An unsafe trait was implemented without an unsafe implementation.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0200
6+
struct Foo;
7+
8+
unsafe trait Bar { }
9+
10+
impl Bar for Foo { } // error!
11+
```
12+
113
Unsafe traits must have unsafe implementations. This error occurs when an
214
implementation for an unsafe trait isn't marked as unsafe. This may be resolved
315
by marking the unsafe implementation as unsafe.
416

5-
```compile_fail,E0200
17+
```
618
struct Foo;
719
820
unsafe trait Bar { }
921
10-
// this won't compile because Bar is unsafe and impl isn't unsafe
11-
impl Bar for Foo { }
12-
// this will compile
13-
unsafe impl Bar for Foo { }
22+
unsafe impl Bar for Foo { } // ok!
1423
```

0 commit comments

Comments
 (0)