Skip to content

Assertion failed in rustc : !(self.has_self && idx == 0) #46568

Closed
@dwarfmaster

Description

@dwarfmaster

When using cargo build to build one of my projects, I got the error the compiler unexpectedly panicked. this is a bug. I tried to minimize my code and got to this point.

I tried this code:

use std::rc::{Rc};
use std::marker::{PhantomData};

pub trait Arrow<'a,A,B>
where A : 'a,
      B : 'a
{
    fn bind<C,Y> (self, y: Y) -> Bind<B,Self,Y>
    where Self: Sized + 'a,
          Y: Arrow<'a,B,C>
    {
    }
}

pub struct Bind<B,X,Y> {
    mid : PhantomData<B>,
    fst : X,
    snd : Rc<Y>,
}

with the command rustc --crate-type lib src/lib.rs

I got the error :

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.22.1 (05e2e1c41 2017-11-22) running on x86_64-unknown-linux-gnu

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

thread 'rustc' panicked at 'assertion failed: !(self.has_self && idx == 0)', /checkout/src/librustc/ty/mod.rs:788:16

Meta

rustc --version --verbose :

rustc 1.22.1 (05e2e1c41 2017-11-22)
binary: rustc
commit-hash: 05e2e1c41414e8fc73d0f267ea8dab1a3eeeaa99
commit-date: 2017-11-22
host: x86_64-unknown-linux-gnu
release: 1.22.1
LLVM version: 4.0

backtrace :

note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
   6: rustc::ty::Generics::type_param
   7: rustc::infer::error_reporting::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::report_region_errors
   8: rustc::infer::InferCtxt::resolve_regions_and_report_errors
   9: rustc_typeck::check::regionck::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::regionck_item
  10: rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor::check_associated_item
  11: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'v>>::visit_trait_item
  12: rustc_typeck::check_crate::{{closure}}
  13: rustc_typeck::check_crate
  14: rustc::ty::context::TyCtxt::create_and_enter
  15: rustc_driver::driver::compile_input
  16: rustc_driver::run_compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions