Skip to content

internal compiler error: src/librustc/hir/def.rs:267: attempted .def_id() on invalid def: SelfCtor(DefId(0/0:1103 #56895

Closed
@TheIronBorn

Description

@TheIronBorn

Another self_struct_ctor internal compiler error very similar to #56202

A minimal example:

#![feature(self_struct_ctor)]

trait FooTrait {}

trait BarTrait {
    fn foo<T: FooTrait>(_: T) -> Self;
}

struct FooStruct {
    x: u32,
    y: u32,
}

impl BarTrait for FooStruct {
    fn foo<T: FooTrait>(_: T) -> Self {
        Self(0)
    }
}
error: internal compiler error: src/librustc/hir/def.rs:267: attempted .def_id() on invalid def: SelfCtor(DefId(0/0:1103 ~ rng_av[108c]::parameters[0]::{{impl}}[8]))

thread 'main' panicked at 'Box<Any>', src/librustc_errors/lib.rs:600:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::bug_fmt
  14: rustc::hir::def::Def::def_id::{{closure}}
  15: rustc::hir::def::Def::def_id
  16: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::confirm_builtin_call
  17: rustc_typeck::check::FnCtxt::check_expr_kind
  18: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  19: rustc_typeck::check::FnCtxt::check_return_expr
  20: rustc_typeck::check::FnCtxt::check_expr_kind
  21: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  22: rustc_typeck::check::FnCtxt::check_block_with_expected
  23: rustc_typeck::check::FnCtxt::check_expr_kind
  24: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  25: rustc_typeck::check::FnCtxt::check_expr_kind
  26: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  27: rustc_typeck::check::FnCtxt::check_block_with_expected
  28: rustc_typeck::check::FnCtxt::check_expr_kind
  29: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  30: rustc_typeck::check::FnCtxt::check_block_with_expected
  31: rustc_typeck::check::FnCtxt::check_expr_kind
  32: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  33: rustc_typeck::check::FnCtxt::check_return_expr
  34: rustc_typeck::check::check_fn
  35: rustc::ty::context::tls::with_related_context
  36: rustc::infer::InferCtxtBuilder::enter
  37: rustc_typeck::check::typeck_tables_of
  38: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_tables_of<'tcx>>::compute
  39: rustc::ty::context::tls::with_context
  40: rustc::dep_graph::graph::DepGraph::with_task_impl
  41: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  42: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  43: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  44: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::ensure_query
  45: rustc::session::Session::track_errors
  46: rustc_typeck::check::typeck_item_bodies
  47: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_item_bodies<'tcx>>::compute
  48: rustc::ty::context::tls::with_context
  49: rustc::dep_graph::graph::DepGraph::with_task_impl
  50: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  51: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  52: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  53: rustc::util::common::time
  54: rustc_typeck::check_crate
  55: rustc::ty::context::tls::enter_context
  56: <std::thread::local::LocalKey<T>>::with
  57: rustc::ty::context::TyCtxt::create_and_enter
  58: rustc_driver::driver::compile_input
  59: rustc_driver::run_compiler_with_pool
  60: <scoped_tls::ScopedKey<T>>::set
  61: rustc_driver::run_compiler
  62: syntax::with_globals
  63: __rust_maybe_catch_panic
  64: rustc_driver::run
  65: rustc_driver::main
  66: std::rt::lang_start::{{closure}}
  67: std::panicking::try::do_call
  68: __rust_maybe_catch_panic
  69: std::rt::lang_start_internal
  70: main
query stack during panic:
#0 [typeck_tables_of] processing `<parameters::Rand16x4 as parameters::Parameter>::modify`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to previous error


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.33.0-nightly (93c2f055b 2018-12-15) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden
rustc 1.33.0-nightly (93c2f055b 2018-12-15)
binary: rustc
commit-hash: 93c2f055ba443385b7c97b1b81fb179db5c9e065
commit-date: 2018-12-15
host: x86_64-apple-darwin
release: 1.33.0-nightly
LLVM version: 8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    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