{"action":"opened","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/40132","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/40132/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/40132/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/40132/events","html_url":"https://github.com/rust-lang/rust/issues/40132","id":210609264,"number":40132,"title":"Specialized Drop impl causes 'internal compiler error'","user":{"login":"Lazarus535","id":26004708,"avatar_url":"https://avatars.githubusercontent.com/u/26004708?v=3","gravatar_id":"","url":"https://api.github.com/users/Lazarus535","html_url":"https://github.com/Lazarus535","followers_url":"https://api.github.com/users/Lazarus535/followers","following_url":"https://api.github.com/users/Lazarus535/following{/other_user}","gists_url":"https://api.github.com/users/Lazarus535/gists{/gist_id}","starred_url":"https://api.github.com/users/Lazarus535/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lazarus535/subscriptions","organizations_url":"https://api.github.com/users/Lazarus535/orgs","repos_url":"https://api.github.com/users/Lazarus535/repos","events_url":"https://api.github.com/users/Lazarus535/events{/privacy}","received_events_url":"https://api.github.com/users/Lazarus535/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-02-27T21:18:06Z","updated_at":"2017-02-27T21:18:06Z","closed_at":null,"body":"Problem:\r\n\r\nrustc crashes with 'internal compiler error' if a special file (see the 'Input' section) is compiled.\r\n\r\nExact error output (run via `cargo run`):\r\n\r\n```\r\n[me@my_machine rustc_bug_1]$ cargo run\r\n   Compiling rustc_bug_1 v0.1.0 (file:///home/me/some_folder/rustc_bug_1)\r\nerror: internal compiler error: /checkout/src/librustc_typeck/check/dropck.rs:650: substs for an impl must map types to TyParam\r\n\r\nnote: the compiler unexpectedly panicked. this is a bug.\r\n\r\nnote: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports\r\n\r\nthread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:417\r\nnote: Run with `RUST_BACKTRACE=1` for a backtrace.\r\n\r\nerror: Could not compile `rustc_bug_1`.\r\n\r\nTo learn more, run the command again with --verbose.\r\n```\r\n\r\nHow to reproduce the error:\r\n\r\n1) Create a new (binary) project with `cargo new rustc_bug_1 --bin`\r\n\r\n2) Put the attached source inside `main.rs`\r\n\r\n3) Run the project with `cargo run`\r\n\r\n4) Witness the error ;-)\r\n\r\nThe error-causeing source:\r\n\r\n```\r\nstruct A<T> {\r\n  a: T,\r\n}\r\n\r\nfn main() {\r\n    struct Z {}\r\n\r\n    let x: A<Z> = A{ a: Z{} };\r\n\r\n    struct DropStruct;\r\n\r\n    impl Drop for A<DropStruct> {\r\n      fn drop(&mut self) {\r\n        println!(\"I'm dropping an A<DropStruct>!\");\r\n      }\r\n    }\r\n}\r\n```\r\n\r\nExplanation:\r\n\r\nI tried some crazy stuff in Rust in order to better understand the languages' semantics when i encountered the bug. I know....usually you cannot specialize the Drop impl, or so the compiler keeps telling me if i further minimize the provided source.\r\n\r\nUsed OS and rust toolchain:\r\n\r\nArch x64 (up2date)\r\nRust Toolchains:\r\n\r\n```\r\nstable-x86_64-unknown-linux-gnu\r\nbeta-x86_64-unknown-linux-gnu\r\nnightly-x86_64-unknown-linux-gnu\r\n```\r\n\r\nTested with all three.\r\n"}}
{"actor":{"display_login":"Lazarus535"}}