Skip to content

Panic after unresolved import: at 'attempted .def_id() on invalid def #31729

Closed
@wolfgang42

Description

@wolfgang42

rustc --version --verbose:

rustc 1.8.0-nightly (fae516277 2016-02-13)
binary: rustc
commit-hash: fae516277b6da46b6c1cf568765c90fad2f9ae4b
commit-date: 2016-02-13
host: i686-unknown-linux-gnu
release: 1.8.0-nightly

Rust panicked on me while I was trying to set up a module. Here's a minimal testcase:

lib.rs:

mod m;
pub extern fn rust_main() {
    m::A::new();
}

m/mod.rs:

pub use A;

Backtrace:

m/mod.rs:1:9: 1:10 error: unresolved import `A`. There is no `A` in `???`. Did you mean to use `m`? [E0432]
m/mod.rs:1 pub use A;
                   ^
m/mod.rs:1:9: 1:10 help: run `rustc --explain E0432` to see a detailed explanation
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
thread 'rustc' panicked at 'attempted .def_id() on invalid def: Err', ../src/librustc/middle/def.rs:142
stack backtrace:
   1: 0xb730834c - sys::backtrace::tracing::imp::write::h387a32948d611c79yru
   2: 0xb7311a31 - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.43392
   3: 0xb73114f8 - panicking::default_handler::hbf5aa91fdd0e1426mZy
   4: 0xb72d6339 - sys_common::unwind::begin_unwind_inner::hea259e071eb3dc55ngt
   5: 0xb72d6dd7 - sys_common::unwind::begin_unwind_fmt::had5362fd9bafeb0ctft
   6: 0xb60084b4 - middle::def::Def::def_id::hef18388ebff5ec86tys
   7: 0xb6caed36 - Resolver<'a, 'tcx>::resolve_path::h1ce47674c3a213038Sf
   8: 0xb6cb346a - Resolver<'a, 'tcx>::resolve_possibly_assoc_item::ha95ba1347bcc1bbbMQf
   9: 0xb6c8c28e - Resolver<'a, 'tcx>::resolve_expr::hb74f3c390e893b10cmg
  10: 0xb6cb9812 - intravisit::walk_expr::h1636770688153136850
  11: 0xb6c8e92d - Resolver<'a, 'tcx>::resolve_expr::hb74f3c390e893b10cmg
  12: 0xb6c8b998 - Resolver<'a, 'tcx>::resolve_block::h1690ef974f337496qof
  13: 0xb6c9468b - Resolver<'a, 'tcx>::resolve_function::h467d20f519802367S3e
  14: 0xb6ca2129 - intravisit::walk_item::h6828430058389820728
  15: 0xb6c89afc - Resolver<'a, 'tcx>::resolve_item::h6a78afdf3910c505yQe
  16: 0xb6cba644 - resolve_crate::h5df60da85863a96eKUg
  17: 0xb762084e - driver::phase_3_run_analysis_passes::h17332131489947047735
  18: 0xb75f560c - driver::compile_input::h9355f12a614fab1eBca
  19: 0xb75e575a - run_compiler::h3b7dbf7e780f38ff8Gc
  20: 0xb75e29b9 - sys_common::unwind::try::try_fn::h12326713950973088752
  21: 0xb7305d07 - __rust_try
  22: 0xb72fd876 - sys_common::unwind::inner_try::hb7a6267c6246d1cepdt
  23: 0xb75e32ef - boxed::F.FnBox<A>::call_box::h13838458491994583776
  24: 0xb730febb - sys::thread::Thread::new::thread_start::hbf982ddd460a42b7GWx
  25: 0xb2666f6f - start_thread
  26: 0xb718abed - clone
  27:        0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions