Skip to content
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

[nightly] compiler panic using detours lib #84572

Closed
ewrogers opened this issue Apr 26, 2021 · 4 comments
Closed

[nightly] compiler panic using detours lib #84572

ewrogers opened this issue Apr 26, 2021 · 4 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ewrogers
Copy link

Code

use std::error::Error;
use std::mem::transmute;
use detour::static_detour;

static_detour! {
    // args: recvBuffer, recvLength
    static on_packet_recv: extern "system" fn(*const u8, u32);
    // args: sendBuffer, sendLength, buffer2, buffer2Length
    static on_packet_sent: extern "system" fn(*const u8, u32, *const u8, u32);
}

type PacketRecvProc = extern "system" fn(*const u8, u32);
type PacketSentProc = extern "system" fn(*const u8, u32, *const u8, u32);

fn setup() -> Result<(), Box<dyn Error>> {
    // this works fine
    let original_recv: PacketRecvProc = unsafe { transmute(0x00467060) };
    // this causes the panic
    let original_sent: PacketSentProc = unsafe { transmute(0x00567FB0) };

    unsafe {
        on_packet_recv.initialize(original_recv, hooked_packet_recv)?.enable()?;
        on_packet_sent.initialize(original_sent, hooked_packet_sent)?.enable()?;
    }

    Ok(())
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (42816d61e 2021-04-24)
binary: rustc
commit-hash: 42816d61ead7e46d462df997958ccfd514f8c21c
commit-date: 2021-04-24
host: x86_64-pc-windows-msvc
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Some(Fingerprint(3377431388032076132, 17454077408356094570))`,
 right: `Some(Fingerprint(7717117747153303598, 10683242120912585319))`: found unstable fingerprints for predicates_of(std[ee4c]::error::Error): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::fmt::Debug>), []), C:\Users\Erik\.rustup\toolchains\nightly-
x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\std\src\error.rs:54:18: 54:23 (#0)), (Binder(TraitPredicate(<Self as std::fmt::Display>), []), C:\Users\Erik\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\std\src\error.rs:54:26: 54:33 (#0)), (Binder(Tra
itPredicate(<Self as std::error::Error>), []), C:\Users\Erik\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\std\src\error.rs:54:1: 54:33 (#0))] }', /rustc/42816d61ead7e46d462df997958ccfd514f8c21c\compiler\rustc_query_system\src\query\plumbing.rs:593:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
Backtrace

stack backtrace:
   0:     0x7fff3d9c5bce - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h65f771762210e3e5
   1:     0x7fff3d9eedac - core::fmt::write::h3d73561f801c6731
   2:     0x7fff3d9b9c28 - <std::io::IoSlice as core::fmt::Debug>::fmt::h6fd08a0ca4059bc8
   3:     0x7fff3d9c9c82 - std::panicking::take_hook::ha49dee799706a2d8
   4:     0x7fff3d9c9774 - std::panicking::take_hook::ha49dee799706a2d8
   5:     0x7fff17d0b2a7 - rustc_driver::report_ice::hab89c69e12b6dd11
   6:     0x7fff3d9ca465 - std::panicking::rust_panic_with_hook::h9e7cc259d68b1de2
   7:     0x7fff3d9ca041 - rust_begin_unwind
   8:     0x7fff3d9c651f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h65f771762210e3e5
   9:     0x7fff3d9c9f99 - rust_begin_unwind
  10:     0x7fff3da22ba0 - core::panicking::panic_fmt::h158e503d917f32a6
  11:     0x7fff3d9eb6b8 - core::panicking::assert_failed_inner::h996c70ce1c4b9208
  12:     0x7fff1c0595c0 - <f64 as ryu::buffer::Sealed>::format_nonfinite::h0e70a5fe4e7d35d9
  13:     0x7fff1a87f43d - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  14:     0x7fff1a8b3aef - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  15:     0x7fff1a91316b - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  16:     0x7fff1a750c10 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  17:     0x7fff1aacaafd - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h3c4346cc01dbde58
  18:     0x7fff1bb092a4 - rustc_middle::ty::generics::GenericPredicates::instantiate_identity::hcdaef7bad58bc872
  19:     0x7fff1bb090d7 - rustc_middle::ty::generics::GenericPredicates::instantiate_identity::hcdaef7bad58bc872
  20:     0x7fff1b9173b7 - rustc_trait_selection::traits::object_safety::trait_has_sized_self::h7a36d858329de003
  21:     0x7fff1b9178de - rustc_trait_selection::traits::object_safety::trait_has_sized_self::h7a36d858329de003
  22:     0x7fff1b91e95c - <rustc_trait_selection::traits::structural_match::NonStructuralMatchTy as core::fmt::Debug>::fmt::hd77ff68d0b934585
  23:     0x7fff1b912b28 - <rustc_trait_selection::traits::project::ProjectionTyCandidate as core::fmt::Debug>::fmt::hcb27ac2609aa574b
  24:     0x7fff1b9152db - <rustc_trait_selection::traits::project::ProjectionTyCandidate as core::fmt::Debug>::fmt::hcb27ac2609aa574b
  25:     0x7fff1b9527e3 - <rustc_trait_selection::traits::select::ProvisionalEvaluation as core::fmt::Debug>::fmt::h565027094b7ab76b
  26:     0x7fff1b95b8b2 - <rustc_trait_selection::traits::select::ProvisionalEvaluation as core::fmt::Debug>::fmt::h565027094b7ab76b
  27:     0x7fff1b97864e - <rustc_trait_selection::traits::TraitQueryMode as core::fmt::Debug>::fmt::he12d5b8742c4b3f2
  28:     0x7fff1b916921 - rustc_trait_selection::traits::object_safety::astconv_object_safety_violations::he351c65e5acd2fe6
  29:     0x7fff1aae1f09 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h3c4346cc01dbde58
  30:     0x7fff1a8ba8eb - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  31:     0x7fff1a8efb53 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  32:     0x7fff1a76ae90 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  33:     0x7fff1aad1177 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h3c4346cc01dbde58
  34:     0x7fff1bb4a704 - rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::is_object_safe::h6e6dc72d6cd3d7be
  35:     0x7fff1b8d977a - rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations::h723bfd0e5638e5fd
  36:     0x7fff1b927ea3 - <rustc_trait_selection::traits::structural_match::NonStructuralMatchTy as core::fmt::Debug>::fmt::hd77ff68d0b934585
  37:     0x7fff1b8d8b1c - <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible::h5a694ae271bde211
  38:     0x7fff1b8d892d - <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_all_or_error::h3290de73ba91357f
  39:     0x7fff1a32c227 - rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::field_ty::h7472c1a5ee78a70b
  40:     0x7fff1a41f873 - <<dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind::hc89e7f26a29e19ed
  41:     0x7fff1a545fba - <rustc_typeck::check::closure::ExpectedSig as core::fmt::Debug>::fmt::h6ccb951e7afc138b
  42:     0x7fff1aae1d79 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h3c4346cc01dbde58
  43:     0x7fff1aa7388f - rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::resolve_instance_of_const_arg>::hash_result::h18d43f9661c06064
  44:     0x7fff1a8fa3da - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  45:     0x7fff1a81fafb - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  46:     0x7fff1a7adb7e - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  47:     0x7fff1aad2542 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h3c4346cc01dbde58
  48:     0x7fff1a54f7ec - <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::intravisit::Visitor>::visit_item::h79b59316ccb35910
  49:     0x7fff1a5177a3 - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::ha36044c869e3f05c
  50:     0x7fff1a444bf1 - <<dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind::hc89e7f26a29e19ed
  51:     0x7fff1a3af38b - <rustc_typeck::check::op::Op as core::fmt::Debug>::fmt::hc2f86cced49ebf11
  52:     0x7fff1a45899c - rustc_typeck::check_crate::hb05ec982ff644b15
  53:     0x7fff17e446f5 - rustc_interface::passes::BoxedResolver::to_resolver_outputs::h51cffbb6bc3edf8f
  54:     0x7fff1aae3929 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h3c4346cc01dbde58
  55:     0x7fff1aa72a42 - rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::resolve_instance_of_const_arg>::hash_result::h18d43f9661c06064
  56:     0x7fff1a9074e7 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  57:     0x7fff1a83d0ea - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  58:     0x7fff1a7d447e - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::hbd68f25166d1e477
  59:     0x7fff1aaca942 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h3c4346cc01dbde58
  60:     0x7fff17d434da - <rustc_middle::ty::SymbolName as core::fmt::Debug>::fmt::ha51d28018e278c75
  61:     0x7fff17d15a3b - rustc_driver::pretty::print_after_hir_lowering::h018530f73994254f
  62:     0x7fff17d0d9dc - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h4409e290eea8174b
  63:     0x7fff17d16d56 - rustc_driver::pretty::print_after_hir_lowering::h018530f73994254f
  64:     0x7fff17d3d0e4 - <rustc_middle::ty::SymbolName as core::fmt::Debug>::fmt::ha51d28018e278c75
  65:     0x7fff17d3f7ff - <rustc_middle::ty::SymbolName as core::fmt::Debug>::fmt::ha51d28018e278c75
  66:     0x7fff17d49ddd - <rustc_middle::ty::SymbolName as core::fmt::Debug>::fmt::ha51d28018e278c75
  67:     0x7fff3d9d851a - std::sys::windows::thread::Thread::new::h35832c8baf769397
  68:     0x7fff90a47034 - BaseThreadInitThunk
  69:     0x7fff926c2651 - RtlUserThreadStart

@ewrogers ewrogers added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 26, 2021
@ewrogers
Copy link
Author

Running cargo clean did seem to fix the issue for me. Leaving this here for any interest.

@hellow554
Copy link
Contributor

Do you know what you did before you ran into the ICE? Maybe you have a git diff or similar?

@Aaron1011
Copy link
Member

Duplicate of #84341

@Aaron1011 Aaron1011 marked this as a duplicate of #84341 Apr 26, 2021
@Aaron1011
Copy link
Member

This is fixed in the latest nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants