]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0569.md
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
[rust.git] / src / librustc_error_codes / error_codes / E0569.md
1 If an impl has a generic parameter with the `#[may_dangle]` attribute, then
2 that impl must be declared as an `unsafe impl.
3
4 Erroneous code example:
5
6 ```compile_fail,E0569
7 #![feature(dropck_eyepatch)]
8
9 struct Foo<X>(X);
10 impl<#[may_dangle] X> Drop for Foo<X> {
11     fn drop(&mut self) { }
12 }
13 ```
14
15 In this example, we are asserting that the destructor for `Foo` will not
16 access any data of type `X`, and require this assertion to be true for
17 overall safety in our program. The compiler does not currently attempt to
18 verify this assertion; therefore we must tag this `impl` as unsafe.