| 159 | |
| 160 | #[inline] |
| 161 | fn trace(&self, cc: &Collection) { |
| 162 | // Okay, so this calls `T::trace` on a *copy* of `T`. |
| 163 | // |
| 164 | // This is theoretically a correctness issue, because technically `T` could have interior |
| 165 | // mutability and modify the copy, and this modification would be lost. |
| 166 | // |
| 167 | // However, currently there is not a type in rust that allows for interior mutability that |
| 168 | // is also `Copy`, so this *currently* impossible to even observe. |
| 169 | // |
| 170 | // I am assured that this requirement is technially "only" a lint, and could be relaxed in |
| 171 | // the future. If this requirement is ever relaxed in some way, fixing this is relatively |
| 172 | // easy, by setting the value of the cell to the copy we make, after tracing (via a drop |
| 173 | // guard in case of panics). Additionally, this is not a safety issue, only a correctness |
| 174 | // issue, the changes will "just" be lost after this call returns. |
| 175 | // |
| 176 | // It could be fixed now, but since it is not even testable because it is currently |
| 177 | // *impossible*, I did not bother. One day this may need to be implemented! |
| 178 | T::trace(&self.get(), cc); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | // Can't use `#[derive]` because of the non-standard bounds. |