blob: 1238165cb88d4f4621992b99c5c9a7f9d9100751 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
A negative implementation was marked as unsafe.
Erroneous code example:
```compile_fail,E0198
struct Foo;
unsafe impl !Clone for Foo { } // error!
```
A negative implementation is one that excludes a type from implementing a
particular trait. Not being able to use a trait is always a safe operation,
so negative implementations are always safe and never need to be marked as
unsafe.
This will compile:
```ignore (ignore auto_trait future compatibility warning)
#![feature(auto_traits)]
struct Foo;
auto trait Enterprise {}
impl !Enterprise for Foo { }
```
Please note that negative impls are only allowed for auto traits.
|