1# Preventing the Derivation of `Copy` and `Clone` 2 3`bindgen` will attempt to derive the `Copy` and `Clone` traits on a best-effort 4basis. Sometimes, it might not understand that although adding `#[derive(Copy, 5Clone)]` to a translated type definition will compile, it still shouldn't do 6that for reasons it can't know. In these cases, the `nocopy` annotation can be 7used to prevent bindgen to autoderive the `Copy` and `Clone` traits for a type. 8 9### Library 10 11* [`bindgen::Builder::no_copy`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.no_copy) 12 13### Command Line 14 15* `--no-copy <regex>` 16 17### Annotations 18 19```c 20/** 21 * Although bindgen can't know, this struct is not safe to move because pthread 22 * mutexes can't move in memory! 23 * 24 * <div rustbindgen nocopy></div> 25 */ 26struct MyMutexWrapper { 27 pthread_mutex_t raw; 28 // ... 29}; 30``` 31