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

thread 'rustc' panicked at 'no representative region', /checkout/src/libcore/option.rs:819:4 #44632

Closed
realcr opened this issue Sep 16, 2017 · 1 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.

Comments

@realcr
Copy link

realcr commented Sep 16, 2017

I tried to compile a piece of code and the compiler crashed.
This is the code that causes the problem:

trait MockFutureTrait {
    type Item;
}

struct MockFuture<T> {
    item: T,
}

impl<T> MockFutureTrait for MockFuture<T> {
    type Item=T;
}

struct FragMsgReceiver<'a,'c:'a> {
    recv_dgram: &'a FnMut(&mut [u8]) -> Box<MockFutureTrait<Item=&mut [u8]> + 'c>,
}
fn constrain_handler<F>(f: F) -> F
where F: for <'r> FnMut(&'r mut [u8]) -> Box<MockFutureTrait<Item=&'r mut [u8]>> {
    f
}

fn main() {
    let mut recv_dgram = constrain_handler(|buf: &mut [u8]| {
        Box::new(MockFuture {
            item: buf,
        }) as Box<MockFutureTrait<Item=&mut [u8]>>
    });

    let ref_recv_dgram = &mut recv_dgram;
    let fmr = FragMsgReceiver {
        recv_dgram: ref_recv_dgram,
    };
}

I suspect that the line where F: for <'r> FnMut(&'r mut [u8]) -> Box<MockFutureTrait<Item=&'r mut [u8]>> { is related to the crash.

I hoped the code to compile, or at least not compile and give me a nice error message.
This is also related to my SO question here.

Meta

$ rustc --version --verbose
rustc 1.21.0-nightly (13d94d5fa 2017-08-10)
binary: rustc
commit-hash: 13d94d5fa8129a34f5c77a1bcd76983f5aed2434
commit-date: 2017-08-10
host: x86_64-unknown-linux-gnu
release: 1.21.0-nightly
LLVM version: 4.0

Backtrace

$ RUST_BACKTRACE=full cargo check
   Compiling noncompiling_lifetime_trait v0.1.0 (.../noncompiling/noncompiling_lifetime_trait)
error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.21.0-nightly (13d94d5fa 2017-08-10) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'no representative region', /checkout/src/libcore/option.rs:819:4
stack backtrace:
   0:     0x7f613ecb0c83 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hc9320db76922c77f
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f613ecab414 - std::sys_common::backtrace::_print::hd1cad143436e7e7b
                               at /checkout/src/libstd/sys_common/backtrace.rs:71
   2:     0x7f613ecbe493 - std::panicking::default_hook::{{closure}}::h8ce44357afd55c76
                               at /checkout/src/libstd/sys_common/backtrace.rs:60
                               at /checkout/src/libstd/panicking.rs:380
   3:     0x7f613ecbe18a - std::panicking::default_hook::h85c58325ebacf8fb
                               at /checkout/src/libstd/panicking.rs:390
   4:     0x7f613ecbe997 - std::panicking::rust_panic_with_hook::hfa335e60391f47d9
                               at /checkout/src/libstd/panicking.rs:610
   5:     0x7f613ecbe7f4 - std::panicking::begin_panic::h30d278ec64e447d3
                               at /checkout/src/libstd/panicking.rs:571
   6:     0x7f613ecbe769 - std::panicking::begin_panic_fmt::hcd587d71433b1406
                               at /checkout/src/libstd/panicking.rs:521
   7:     0x7f613ecbe6fa - rust_begin_unwind
                               at /checkout/src/libstd/panicking.rs:497
   8:     0x7f613ecfefa0 - core::panicking::panic_fmt::h39daae460f714f61
                               at /checkout/src/libcore/panicking.rs:71
   9:     0x7f613ecff00d - core::option::expect_failed::h950b5744b96e90a4
                               at /checkout/src/libcore/option.rs:819
  10:     0x7f613bb8274d - rustc::infer::InferCtxt::match_poly_projection_predicate::h7cdea5d9923c1547
  11:     0x7f613bc0a028 - rustc::traits::project::confirm_param_env_candidate::h9272de6f49d53275
  12:     0x7f613bc09dde - rustc::traits::project::confirm_callable_candidate::h65de99afd0ee75f4
  13:     0x7f613bc09a92 - rustc::traits::project::confirm_closure_candidate::h4d1b6993371710c1
  14:     0x7f613bc08928 - rustc::traits::project::confirm_candidate::h3d4c618bc3cc9ea9
  15:     0x7f613bc06e35 - rustc::traits::project::opt_normalize_projection_type::h91fef886d54f4389
  16:     0x7f613bc0283f - rustc::traits::project::poly_project_and_unify_type::{{closure}}::h4c1f58cafeb751d1
  17:     0x7f613bc02406 - rustc::traits::project::poly_project_and_unify_type::h00e4d6f4aed39050
  18:     0x7f613bc0043b - <rustc::traits::fulfill::FulfillProcessor<'a, 'b, 'gcx, 'tcx> as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation::he3ca956ae5013358
  19:     0x7f613bbff29f - rustc::traits::fulfill::FulfillmentContext::select::hefab09daa26270d9
  20:     0x7f613bbfe947 - rustc::traits::fulfill::FulfillmentContext::select_where_possible::h61b467f90f61b84a
  21:     0x7f613c10934e - rustc_typeck::check::FnCtxt::select_obligations_where_possible::h52bef7c97c0eb449
  22:     0x7f613c1079d6 - rustc_typeck::check::FnCtxt::resolve_type_vars_with_obligations::h8c5e37d40475b2c4
  23:     0x7f613c0b8ad8 - rustc_typeck::check::demand::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::demand_coerce::ha42166c66a50b636
  24:     0x7f613c11e2c3 - rustc_typeck::check::FnCtxt::check_decl_local::hd2968d1d52af8618
  25:     0x7f613c11ec81 - rustc_typeck::check::FnCtxt::check_block_with_expected::{{closure}}::h82a74948a706d3f2
  26:     0x7f613c11e688 - rustc_typeck::check::FnCtxt::check_block_with_expected::h689be9ae83db888e
  27:     0x7f613c112241 - rustc_typeck::check::FnCtxt::check_expr_kind::h0e034806c0640e1d
  28:     0x7f613c110cd2 - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h8a32a773ec83482f
  29:     0x7f613c10cc71 - rustc_typeck::check::FnCtxt::check_return_expr::h2a6b3f2954cd404d
  30:     0x7f613c0feaed - rustc_typeck::check::check_fn::he6fe52d652431556
  31:     0x7f613c0f8dc6 - rustc_typeck::check::typeck_tables_of::{{closure}}::h729ebe10d2f47787
  32:     0x7f613c0f8930 - rustc_typeck::check::typeck_tables_of::h29cbfeec62f1849e
  33:     0x7f613bacd4dd - rustc::dep_graph::graph::DepGraph::with_task::h450f55c1a9fcbd74
  34:     0x7f613bceb2ea - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get::h556c3eb09c2c7d21
  35:     0x7f613bd2353a - rustc::ty::maps::TyCtxtAt::typeck_tables_of::h78c1a7f7ca156eb2
  36:     0x7f613bd1f9d6 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of::h837a829971c907ae
  37:     0x7f613c0f7eb7 - rustc_typeck::check::typeck_item_bodies::h0f8ae19b232d2120
  38:     0x7f613bacf8ed - rustc::dep_graph::graph::DepGraph::with_task::ha14cbe06d8885f55
  39:     0x7f613bce9ff5 - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get::h3c646c870f54cabf
  40:     0x7f613bd233f5 - rustc::ty::maps::TyCtxtAt::typeck_item_bodies::h271de086ad24efe2
  41:     0x7f613bd1f9a6 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies::h2e56734515ae4638
  42:     0x7f613c14f831 - rustc_typeck::check_crate::he7514f54bbc90a21
  43:     0x7f613efe25b0 - rustc::ty::context::TyCtxt::create_and_enter::hf0b1401af74e7747
  44:     0x7f613f03fed1 - rustc_driver::driver::compile_input::h7e4322197bc87ab7
  45:     0x7f613f059782 - rustc_driver::run_compiler::h7ff66578813a854d
  46:     0x7f613ef97261 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2a0cfbdf7b97e796
  47:     0x7f613ecededc - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:98
  48:     0x7f613efca900 - <F as alloc::boxed::FnBox<A>>::call_box::hb763c222ac18e463
  49:     0x7f613ecbd3cb - std::sys::imp::thread::Thread::new::thread_start::h79a2d07a57977c8b
                               at /checkout/src/liballoc/boxed.rs:692
                               at /checkout/src/libstd/sys_common/thread.rs:21
                               at /checkout/src/libstd/sys/unix/thread.rs:84
  50:     0x7f6139ea76b9 - start_thread
  51:     0x7f613e96c3dc - clone
  52:                0x0 - <unknown>

error: Could not compile `noncompiling_lifetime_trait`.
@Mark-Simulacrum Mark-Simulacrum 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 Sep 18, 2017
@arielb1
Copy link
Contributor

arielb1 commented Nov 14, 2017

Doesn't ICE on either stable, beta, or nightly. Closing.

@arielb1 arielb1 closed this as completed Nov 14, 2017
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