-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE when trying to implement Drop generically #41974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Background: rust-nightly, version |
Also present in |
Implementing With that said, the compiler probably shouldn't ICE on this! |
Thank you. I was trying to avoid writing and maintaining a lot of tedious, duplicated boilerplate... |
Can you provide a code example (preferably minimal?) |
Nope; it was a long time ago. |
I encountered this same issue on rustc 1.21 (with a very similar use case). Unfortunately, while I can reproduce it in my project, I can't come up with a minimal example that reproduces the ICE. The full otuput look like
|
Actually, I was able to get a minimal reproduction: https://play.rust-lang.org/?gist=3c42e05707afa39f805997dc2f2f4f08&version=undefined |
Further reduced (playground): #[derive(Copy, Clone)]
struct Flags;
trait A {
}
impl<T> Drop for T where T: A {
fn drop(&mut self) {
}
} |
…-drop, r=estebank Delay panic from incoherent drop implementation Closes rust-lang#41974
I've defined a trait
CompletionQueue<'a>
, which wraps various FFI*mut xxx
pointers. All of these pointers can be freed by the same FFI function, so to reduce code duplication, I defined apointer()
method on myCompletionQueue<'a>
trait, and tried to define a generic implementation of Drop that is basicallyunsafe { ff_drop_function(self.pointer()) }
. This causes the compiler to panic...The text was updated successfully, but these errors were encountered: