Skip to content

'index out of bounds: the len is 1 but the index is 1': libcore/slice/mod.rs #68801

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
muni-corn opened this issue Feb 1, 2020 · 29 comments · Fixed by #69148
Closed

'index out of bounds: the len is 1 but the index is 1': libcore/slice/mod.rs #68801

muni-corn opened this issue Feb 1, 2020 · 29 comments · Fixed by #69148
Assignees
Labels
A-borrow-checker Area: The borrow checker A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@muni-corn
Copy link

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/cd1ef390e73
1ed77b90b11b1f77e2c5ca641b261/src/libcore/slice/mod.rs:2791:10
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.

Edit: Clippy version:

clippy 0.0.212 (c0f39cf 2020-01-29)
@JohnTitor
Copy link
Member

Could you provide reproducible example?

@mati865
Copy link
Member

mati865 commented Feb 1, 2020

Or at least please run with RUST_BACKTRACE=1 if your code is private.

@muni-corn
Copy link
Author

Here's a full backtrace:

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/cd1ef390e731ed77b90b11b1f77e2c5ca641b261/src/libcore/slice/mod.rs:2791:10
stack backtrace:
   0:     0x7f0574cb8f08 - backtrace::backtrace::libunwind::trace::ha50d6e1700b0eb2c
                               at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7f0574cb8f08 - backtrace::backtrace::trace_unsynchronized::hed6300b0e8a8d34c
                               at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x7f0574cb8f08 - std::sys_common::backtrace::_print_fmt::h02d8d6e59c4a6ffd
                               at src/libstd/sys_common/backtrace.rs:77
   3:     0x7f0574cb8f08 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1f642adc5bdda227
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7f0574cf1f1c - core::fmt::write::h3f76f88b1fce4812
                               at src/libcore/fmt/mod.rs:1052
   5:     0x7f0574caa8c7 - std::io::Write::write_fmt::hbb03ae82f9cef6e9
                               at src/libstd/io/mod.rs:1428
   6:     0x7f0574cbdcd5 - std::sys_common::backtrace::_print::h21ddaa53463c7888
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7f0574cbdcd5 - std::sys_common::backtrace::print::h335952ea8eeb247c
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7f0574cbdcd5 - std::panicking::default_hook::{{closure}}::hf030245da7008606
                               at src/libstd/panicking.rs:204
   9:     0x7f0574cbda16 - std::panicking::default_hook::hf0ffbda78fb7d847
                               at src/libstd/panicking.rs:224
  10:     0x563d08964101 - clippy_driver::report_clippy_ice::he21cf02dfc7e1758
  11:     0x7f0574cbe405 - std::panicking::rust_panic_with_hook::hb1798496edc01b7d
                               at src/libstd/panicking.rs:476
  12:     0x7f0574cbdf1b - rust_begin_unwind
                               at src/libstd/panicking.rs:380
  13:     0x7f0574cee911 - core::panicking::panic_fmt::h59f3772040c83eb0
                               at src/libcore/panicking.rs:85
  14:     0x7f0574cee8d5 - core::panicking::panic_bounds_check::h189a5a5e8747cf2a
                               at src/libcore/panicking.rs:63
  15:     0x7f057651eb51 - rustc_mir::borrow_check::type_check::type_check::h576502a08b9b84c8
  16:     0x7f057607578f - rustc_mir::borrow_check::nll::compute_regions::h3259eef4b8afbcfc
  17:     0x7f05764e8f8d - rustc_mir::borrow_check::do_mir_borrowck::hd8604f292f501c96
  18:     0x7f05763a0768 - rustc::ty::context::GlobalCtxt::enter_local::h6691f4f1e1d907c0
  19:     0x7f05764e65fa - rustc_mir::borrow_check::mir_borrowck::h0254b9c083de3cd9
  20:     0x7f05753c2c62 - rustc::ty::query::__query_compute::mir_borrowck::h0117a0c701e4297a
  21:     0x7f057547e49c - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute::h7999cf1a6634c4a5
  22:     0x7f05754767c9 - rustc::dep_graph::graph::DepGraph::with_task_impl::h934c148d9ba13f5e
  23:     0x7f0575498fc2 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hd533d692e1fbc7b1
  24:     0x7f057547df96 - rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners::hc8f96788de8a2340
  25:     0x7f0575416846 - rustc_session::utils::<impl rustc_session::session::Session>::time::h3ae7f9e218ae904f
  26:     0x7f05754b1651 - rustc_interface::passes::analysis::h90283b0b6dab2283
  27:     0x7f0575217411 - rustc::ty::query::__query_compute::analysis::h33b18770fdd73590
  28:     0x7f05752702d5 - rustc::dep_graph::graph::DepGraph::with_task_impl::hb1aaaca00de6ca43
  29:     0x7f05752849f4 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h283712dc98c9b497
  30:     0x7f057526da25 - rustc::ty::context::tls::enter_global::hacc4d38b5d7a50f2
  31:     0x7f05752248d7 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h357db3898471cc2c
  32:     0x7f057521307d - scoped_tls::ScopedKey<T>::set::hf06d4d1755916e12
  33:     0x7f057520fdd4 - syntax::with_globals::h3b7b82ab2e985d2f
  34:     0x7f0575214420 - std::sys_common::backtrace::__rust_begin_short_backtrace::h7b107b73a1c5ae11
  35:     0x7f0574ccf9b7 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  36:     0x7f0575228046 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hec461b14581c2073
  37:     0x7f0574c9b38f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hb48f4f4cca7ec7cf
                               at /rustc/cd1ef390e731ed77b90b11b1f77e2c5ca641b261/src/liballoc/boxed.rs:1015
  38:     0x7f0574cce5b0 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h2beff019c430fe28
                               at /rustc/cd1ef390e731ed77b90b11b1f77e2c5ca641b261/src/liballoc/boxed.rs:1015
  39:     0x7f0574cce5b0 - std::sys_common::thread::start_thread::h9de1d746dee0c0e7
                               at src/libstd/sys_common/thread.rs:13
  40:     0x7f0574cce5b0 - std::sys::unix::thread::Thread::new::thread_start::h881c9f01765d0bcb
                               at src/libstd/sys/unix/thread.rs:80
  41:     0x7f0574bdf4cf - start_thread
  42:     0x7f0574aed2d3 - clone
  43:                0x0 - <unknown>

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-clippy/issues/new

note: Clippy version: clippy 0.0.212 (c0f39cf 2020-01-29)

query stack during panic:
#0 [mir_borrowck] processing `daemon::Daemon::start`
rust-lang/rust-clippy#1 [analysis] running analysis passes on this crate
end of query stack

Hope it helps :)

@JohnTitor
Copy link
Member

JohnTitor commented Feb 1, 2020

Uhm, I guess it's a rustc ICE probably, does it also happen when you run rustc main.rs, cargo run, or something?

@muni-corn
Copy link
Author

muni-corn commented Feb 1, 2020 via email

@basil-cow
Copy link
Contributor

basil-cow commented Feb 2, 2020

@harrisonthorne you might not realize it because it was sent via email, but your last comment is empty

@muni-corn
Copy link
Author

Oops, I misread @JohnTitor 's comment. It happens with cargo check as well.

@JohnTitor
Copy link
Member

Thanks! So it's not a Clippy ICE but a rustc ICE.
@oli-obk or someone, could you transfer this issue to rust-lang/rust repo?

@oli-obk oli-obk transferred this issue from rust-lang/rust-clippy Feb 3, 2020
@oli-obk oli-obk added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Feb 3, 2020
@JohnTitor JohnTitor added C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Feb 3, 2020
@jonas-schievink jonas-schievink added the A-borrow-checker Area: The borrow checker label Feb 3, 2020
@estebank
Copy link
Contributor

estebank commented Feb 3, 2020

What rustc version are you running?

@Centril
Copy link
Contributor

Centril commented Feb 3, 2020

cc @matthewjasper

@threecgreen
Copy link

I got a similar panic with rustc 1.43.0-nightly (58b8343 2020-02-05)

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/58b834344fc7b9185e7a50db1ff24e5eb07dae5e/src/libcore/slice/mod.rs:2791:10
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt               at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /rustc/58b834344fc7b9185e7a50db1ff24e5eb07dae5e/src/liballoc/boxed.rs:1030
  12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /rustc/58b834344fc7b9185e7a50db1ff24e5eb07dae5e/src/libproc_macro/bridge/client.rs:305
  13: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  14: rust_begin_unwind
             at src/libstd/panicking.rs:378
  15: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  16: core::panicking::panic_bounds_check
             at src/libcore/panicking.rs:63
  17: rustc_mir::borrow_check::type_check::type_check
  18: rustc_mir::borrow_check::nll::compute_regions
  19: rustc_mir::borrow_check::do_mir_borrowck
  20: rustc::ty::context::GlobalCtxt::enter_local
  21: rustc_mir::borrow_check::mir_borrowck
  22: rustc::ty::query::__query_compute::mir_borrowck
  23: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
  24: rustc::dep_graph::graph::DepGraph::with_task_impl
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  26: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
  27: rustc_session::utils::<impl rustc_session::session::Session>::time
  28: rustc_interface::passes::analysis
  29: rustc::ty::query::__query_compute::analysis
  30: rustc::dep_graph::graph::DepGraph::with_task_impl
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  32: rustc::ty::context::tls::enter_global
  33: rustc_interface::interface::run_compiler_in_existing_thread_pool
  34: scoped_tls::ScopedKey<T>::set
  35: syntax::attr::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.  
error: internal compiler error: unexpected panic

@pnkfelix
Copy link
Member

pnkfelix commented Feb 6, 2020

@threecgreen that is great that you can reproduce this bug. Can you provide a code sample for the reproduction, or a link to the source code for your crate where you are seeing it?

@pnkfelix
Copy link
Member

pnkfelix commented Feb 6, 2020

triage: I don't want to assign a priority to this without more information. leaving nominated to ensure I come back to it.

@threecgreen
Copy link

I was not able to easily create a small code sample, but this was the state of my code when I saw the panic.

@jonas-schievink
Copy link
Contributor

I just caused a lot of these to appear in the async/await tests when changing the HIR lowering of async/await. I've pushed that state as https://github.com/jonas-schievink/rust/commit/1197e62c8573e72c41231dc65d58c9a0efc13ecb. I probably did something wrong in the HIR building code, but a similar issue might be preexisting, which could cause this I guess.

@nikomatsakis
Copy link
Contributor

@rustbot ping icebreakers-cleanup-crew

Dear cleanup crew, it would be great to try and narrow this down to a self-contained example. @threecgreen has a crate here that reproduces the problem, but it's not a small, workable example.

@rustbot
Copy link
Collaborator

rustbot commented Feb 13, 2020

Hey Cleanup Crew ICE-breakers! This bug has been identified as a good
"Cleanup ICE-breaking candidate". In case it's useful, here are some
instructions for tackling these sorts of bugs. Maybe take a look?
Thanks! <3

cc @AminArria @chrissimpkins @DutchGhost @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @matheus-consoli @mental32 @Noah-Kennedy @pard68 @pierreN @robjtede @senden9 @shekohex @sinato @spastorino @turboladen @woshilapin @yerke

@rustbot rustbot added the ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections label Feb 13, 2020
@nikomatsakis
Copy link
Contributor

Also would be good to know if this is a regression.

@nikomatsakis nikomatsakis added the P-high High priority label Feb 13, 2020
@nikomatsakis
Copy link
Contributor

Tagging as P-high for now because the ICE gives so little actionable information to guide the user as to how to correct the problem.

@eopb
Copy link
Contributor

eopb commented Feb 13, 2020

@harrisonthorne Can you run cargo bisect on this so we can identify if this is a regression in rustc.

@chrissimpkins
Copy link
Member

chrissimpkins commented Feb 13, 2020

rustc 1.43.0-nightly (a1912f2e8 2020-02-12)
binary: rustc
commit-hash: a1912f2e89b77cfe2a0e64b96f444848fe4e2d49
commit-date: 2020-02-12
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0

Source: crash-demo branch of https://github.com/threecgreen/vinoteca/tree/crash-demo

There are multiple ICE error types coming from this source:

pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> {
    table
        .inner_join(wines::table.inner_join(purchases::table))
        .group_by((producers::id, producers::name))
        .select((
            wines::id,
            wines::name,
            sql::<Integer>("sum(purchases.quantity)"),
            // Should probably be distinct
            sql::<Integer>("count(wines.id)"),
            sql::<Float>("avg(purchases.price)"),
        ))
        .order_by(sql::<Integer>("sum(purchases.quantity) DESC"))
        .limit(limit as i64)
        .load::<TopWineType>(&*connection)
        .map(Json)
        .map_err(VinotecaError::from)
}

ICE's:

  • bad placeholder type
  • cat_expr Errd
  • PromoteTemps: MIR had errors
  • broken MIR in DefId(0:84 ~ vinoteca[2dad]::producers[0]::top[0]) ("return type"): bad type [type error]
  • broken MIR in DefId(0:84 ~ vinoteca[2dad]::producers[0]::top[0]) (LocalDecl { mutability: Mut, local_info: Other, internal: false, is_block_tail: None, ty: [type error], user_ty: UserTypeProjections { contents: [] }, source_info: SourceInfo { span: src/producers.rs:43:1: 60:2, scope: scope[0] } }): bad type [type error]

then this panic:

  • thread 'rustc' panicked at 'no errors encountered even though delay_span_bug issued'

@chrissimpkins
Copy link
Member

chrissimpkins commented Feb 13, 2020

Regression in the vinoteca source.

edit: Not the same ICE that was reported in the OP

Tested with builds of the full crate

searched nightlies: from nightly-2019-08-01 to nightly-2020-02-01
regressed nightly: nightly-2020-01-01
searched commits: from a9dd56f to 119307a
regressed commit: 71bb0ff
source code: https://github.com/threecgreen/vinoteca/tree/crash-demo

Errors before the regression:

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> src/producers.rs:43:70
   |
43 | pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> {
   |                                                                      ^ not allowed in type signatures

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> src/producers.rs:43:109
   |
43 | pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> {
   |                                                                                                             ^ not allowed in type signatures

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0121`.
error: could not compile `vinoteca`.

Reproduce rustc bisect report:

cargo bisect-rustc --start 2019-12-31 --end 2020-01-01 --prompt

@estebank
Copy link
Contributor

estebank commented Feb 13, 2020

Mea culpa. Introduced in #67597. I would have imagined that this would have been covered by #68071, but clearly it isn't.

Minimized:

trait T<A> {}
fn foo<X: T<_>>(x: X) {}

@estebank estebank self-assigned this Feb 13, 2020
@estebank estebank removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Feb 13, 2020
@chrissimpkins
Copy link
Member

chrissimpkins commented Feb 13, 2020

@estebank Esteban, I'm not sure if this is the same ICE that was reported in the OP. The source that I used was from #68801 (comment) based on the request in #68801 (comment).

I'm not seeing a 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1' ICE in the vinoteca source with the current nightly.

@estebank
Copy link
Contributor

@chrissimpkins by fixing that underlying bad gating of _ in type parameters the crate no longer panics:

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> src/producers.rs:43:70
   |
43 | pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> {
   |                                                                      ^ not allowed in type signatures

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> src/producers.rs:43:109
   |
43 | pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> {
   |                                                                                                             ^ not allowed in type signatures

error: aborting due to 2 previous errors

@jyn514
Copy link
Member

jyn514 commented Feb 18, 2020

I have a repro for the first panic, not for the panic while panicking yet:

extern crate diesel;
pub fn top<Table: diesel::Table +
                  diesel::query_dsl::InternalJoinDsl<
                    _, diesel::query_source::joins::Inner, _
                  >>(
    table: Table
) {}
$ cargo +nightly check
error: internal compiler error: bad placeholder type
 --> src/lib.rs:4:21
  |
4 |                     _, diesel::query_source::joins::Inner, _
  |                     ^

error: internal compiler error: bad placeholder type
 --> src/lib.rs:4:60
  |
4 |                     _, diesel::query_source::joins::Inner, _
  |                                                            ^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:347:17
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.

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

note: rustc 1.42.0-nightly (859764425 2020-01-07) running on x86_64-unknown-linux-musl

note: compiler flags: -C debuginfo=2 -C incremental -C target-feature=-crt-static --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: could not compile `vinoteca`.

@jyn514
Copy link
Member

jyn514 commented Feb 18, 2020

Ok, I think this is as small as I can make all 8 errors:

code
#[macro_use]
extern crate diesel;

mod schema {
    table! {
        producers (id) {
            id -> Integer,
        }
    }

    table! {
        purchases (id) {
            id -> Integer,
            wine_id -> Integer,
        }
    }

    table! {
        wines (id) {
            id -> Integer,
            producer_id -> Integer,
        }
    }

    joinable!(purchases -> wines (wine_id));

    allow_tables_to_appear_in_same_query!(
        producers,
        purchases,
        wines,
    );
}

mod model {
    use crate::schema::{purchases, wines};
    use diesel::prelude::*;

    pub fn top<Table: diesel::Table +
                      diesel::query_dsl::InternalJoinDsl<
                        _, diesel::query_source::joins::Inner, _
                      >>(
        table: Table
    ) {
        table.inner_join(wines::table.inner_join(purchases::table))
    }
}
errors
thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/85976442558bf2d09cec3aa49c9c9ba86fb15c1f/src/libcore/slice/mod.rs:2791:10
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.

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

note: rustc 1.42.0-nightly (859764425 2020-01-07) running on x86_64-unknown-linux-musl

note: compiler flags: -C debuginfo=2 -C incremental -C target-feature=-crt-static --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: internal compiler error: bad placeholder type
  --> src/lib.rs:40:25
   |
40 |                         _, diesel::query_source::joins::Inner, _
   |                         ^

error: internal compiler error: bad placeholder type
  --> src/lib.rs:40:64
   |
40 |                         _, diesel::query_source::joins::Inner, _
   |                                                                ^

error: internal compiler error: cat_expr Errd
  --> src/lib.rs:44:9
   |
44 |         table.inner_join(wines::table.inner_join(purchases::table))
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: PromoteTemps: MIR had errors
  --> src/lib.rs:38:5
   |
38 | /     pub fn top<Table: diesel::Table +
39 | |                       diesel::query_dsl::InternalJoinDsl<
40 | |                         _, diesel::query_source::joins::Inner, _
41 | |                       >>(
...  |
44 | |         table.inner_join(wines::table.inner_join(purchases::table))
45 | |     }
   | |_____^

error: internal compiler error: broken MIR in DefId(0:10 ~ vinoteca[fe16]::model[0]::top[0]) ("return type"): bad type [type error]
  --> src/lib.rs:38:5
   |
38 | /     pub fn top<Table: diesel::Table +
39 | |                       diesel::query_dsl::InternalJoinDsl<
40 | |                         _, diesel::query_source::joins::Inner, _
41 | |                       >>(
...  |
44 | |         table.inner_join(wines::table.inner_join(purchases::table))
45 | |     }
   | |_____^

error: internal compiler error: broken MIR in DefId(0:10 ~ vinoteca[fe16]::model[0]::top[0]) (LocalDecl { mutability: Mut, local_info: Other, internal: false, is_block_tail: None, ty: [type error], user_ty: UserTypeProjections { contents: [] }, source_info: SourceInfo { span: src/lib.rs:38:5: 45:6, scope: scope[0] } }): bad type [type error]
  --> src/lib.rs:38:5
   |
38 | /     pub fn top<Table: diesel::Table +
39 | |                       diesel::query_dsl::InternalJoinDsl<
40 | |                         _, diesel::query_source::joins::Inner, _
41 | |                       >>(
...  |
44 | |         table.inner_join(wines::table.inner_join(purchases::table))
45 | |     }
   | |_____^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:347:17
stack backtrace:
   0:     0x7f495cc6e4c4 - backtrace::backtrace::libunwind::trace::h208b77d6980cdba3
                               at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7f495cc6e4c4 - backtrace::backtrace::trace_unsynchronized::h279c5063b29b89e0
                               at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x7f495cc6e4c4 - std::sys_common::backtrace::_print_fmt::h0dd5ce3b2c0c1196
                               at src/libstd/sys_common/backtrace.rs:77
   3:     0x7f495cc6e4c4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h64e0000db2a39f17
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7f495cc9e9ec - core::fmt::write::h97bceedab1a3faef
                               at src/libcore/fmt/mod.rs:1057
   5:     0x7f495cc618c7 - std::io::Write::write_fmt::hdf931701cccb1c38
                               at src/libstd/io/mod.rs:1426
   6:     0x7f495cc7296e - std::sys_common::backtrace::_print::h206f5e67efbe6095
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7f495cc7296e - std::sys_common::backtrace::print::h2e216a34252f7d84
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7f495cc7296e - std::panicking::default_hook::{{closure}}::hdf8b9b1ee9f4dcfe
                               at src/libstd/panicking.rs:195
   9:     0x7f495cc72661 - std::panicking::default_hook::h98bc5701a731ade9
                               at src/libstd/panicking.rs:215
  10:     0x7f495d5866b3 - rustc_driver::report_ice::hdbf2866e344d6245
  11:     0x7f49563348f8 - <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call::hdd55ec429bea19f0
                               at /rustc/85976442558bf2d09cec3aa49c9c9ba86fb15c1f/src/liballoc/boxed.rs:1029
  12:     0x7f495631d354 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::hbc8b828c4363939a
                               at /rustc/85976442558bf2d09cec3aa49c9c9ba86fb15c1f/src/libproc_macro/bridge/client.rs:305
  13:     0x7f495cc73089 - std::panicking::rust_panic_with_hook::h7277f8b6e4c099fd
                               at src/libstd/panicking.rs:467
  14:     0x7f4961835dee - std::panicking::begin_panic::hd548f822c14e0cbe
  15:     0x7f4961868cfc - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hcf14cbbd78c44984
  16:     0x7f495d571e76 - core::ptr::real_drop_in_place::hc517d173be821d25
  17:     0x7f495d56c0f3 - core::ptr::real_drop_in_place::ha038d4c0a443cf63
  18:     0x7f495d5596cc - core::ptr::real_drop_in_place::h3255152b619a5178
  19:     0x7f495d553cad - rustc_interface::interface::run_compiler_in_existing_thread_pool::h8e3bab68016629f6
  20:     0x7f495d52a6fd - scoped_tls::ScopedKey<T>::set::h32b9d2143e69dde9
  21:     0x7f495d5a3d54 - syntax::with_globals::hb27713d83228f67a
  22:     0x7f495d5240c0 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1eb36621cab00684
  23:     0x7f495cc82e3a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:79
  24:     0x7f495d534e19 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hf5249265f3209535
  25:     0x7f495cc5366f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h0bf48004752a5fb0
                               at /rustc/85976442558bf2d09cec3aa49c9c9ba86fb15c1f/src/liballoc/boxed.rs:1015
  26:     0x7f495cc82010 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h8142139182c9e7b6
                               at /rustc/85976442558bf2d09cec3aa49c9c9ba86fb15c1f/src/liballoc/boxed.rs:1015
  27:     0x7f495cc82010 - std::sys_common::thread::start_thread::h1e46798ecd04df83
                               at src/libstd/sys_common/thread.rs:13
  28:     0x7f495cc82010 - std::sys::unix::thread::Thread::new::thread_start::h8fe9d151ada3a9de
                               at src/libstd/sys/unix/thread.rs:80
  29:     0x7f496386f72b - <unknown>

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.42.0-nightly (859764425 2020-01-07) running on x86_64-unknown-linux-musl

note: compiler flags: -C debuginfo=2 -C incremental -C target-feature=-crt-static --crate-type lib

note: some of the compiler flags provided by cargo are hidden

thread panicked while panicking. aborting.

@hellow554
Copy link
Contributor

@estebank is this related to your PR #69148 and will this be fixed as well?

@estebank
Copy link
Contributor

@hellow554 I'm 99% sure it will.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Feb 28, 2020
Account for bounds and asociated items when denying `_`

Fix rust-lang#68801, rust-lang#69204. Follow up to rust-lang#67597 and rust-lang#68071.

Output for the original ICE report:

```
    Checking vinoteca v5.0.0 (/Users/ekuber/workspace/vinoteca)
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> src/producers.rs:43:70
   |
43 | pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> {
   |                                                                      ^ not allowed in type signatures       ^ not allowed in type signatures

error: aborting due to previous error
```
@bors bors closed this as completed in eaa02f5 Feb 28, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-borrow-checker Area: The borrow checker A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.