Skip to content

rustc nightly 2016-02-13: unexpected panic when external crate conflicts with module  #31714

@JDemler

Description

@JDemler

While trying out benchmark-tests I ran into an unexpected panic:

#![feature(test)]

extern crate test;

#[cfg(test)]
mod test {

    #[test]
    fn it_works(){
    }    
}

compiled with rustc --test

Reproducible at Rust Playground

Meta

rustc --version --verbose:

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

Compiler Output with Backtrace:

rustc --test lib.rs:

lib.rs:8:1: 15:2 error: the name `test` conflicts with an external crate that has been imported into this module [E0260]
lib.rs: 8 mod test {
lib.rs: 9     use super::*;
lib.rs:10 
lib.rs:11     #[test]
lib.rs:12     fn it_works(){
lib.rs:13 
          ...
lib.rs:8:1: 15:2 help: run `rustc --explain E0260` to see a detailed explanation
error: unresolved import `super::test::__test_reexports`. There is no `__test_reexports` in `test` [E0432]
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:     0x7efdacedbfd0 - sys::backtrace::tracing::imp::write::hd6d99fcaca6f3487qru
   2:     0x7efdacee4f9b - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.43421
   3:     0x7efdacee4af3 - panicking::default_handler::hd56ae5efa8870fb8eZy
   4:     0x7efdacead90c - sys_common::unwind::begin_unwind_inner::hddffc5a57d251d30fgt
   5:     0x7efdaceae3a8 - sys_common::unwind::begin_unwind_fmt::h305a1896c8e2e020lft
   6:     0x7efdaa20925e - middle::def::Def::def_id::h918ee6147a33b88btys
   7:     0x7efdab88849f - Resolver<'a, 'tcx>::resolve_crate_relative_path::h90799ec829db2654C5f
   8:     0x7efdab888df0 - Resolver<'a, 'tcx>::resolve_path::h18ab824589db4c238Sf
   9:     0x7efdab88f7df - Resolver<'a, 'tcx>::resolve_possibly_assoc_item::h38577ef9bf67ec0eMQf
  10:     0x7efdab86a01c - Resolver<'a, 'tcx>::resolve_expr::h1a8e4341189179a7cmg
  11:     0x7efdab894d87 - intravisit::walk_expr::h2695994321809930199
  12:     0x7efdab895423 - intravisit::walk_expr::h2695994321809930199
  13:     0x7efdab86a71d - Resolver<'a, 'tcx>::resolve_expr::h1a8e4341189179a7cmg
  14:     0x7efdab894d05 - intravisit::walk_expr::h2695994321809930199
  15:     0x7efdab87ee5b - intravisit::walk_item::h11552281323803220262
  16:     0x7efdab8656d8 - Resolver<'a, 'tcx>.Visitor<'v>::visit_item::hb4a29193ce0e640a37c
  17:     0x7efdab87ef0a - intravisit::walk_item::h11552281323803220262
  18:     0x7efdab867d5f - Resolver<'a, 'tcx>.Visitor<'v>::visit_item::hb4a29193ce0e640a37c
  19:     0x7efdab896796 - resolve_crate::hef29d643839c0d6bKUg
  20:     0x7efdad3ef538 - driver::phase_3_run_analysis_passes::h16257317625067277007
  21:     0x7efdad3c2daa - driver::compile_input::ha4ae3a60f7db99f6Bca
  22:     0x7efdad3b2cb3 - run_compiler::h65293143fe622e848Gc
  23:     0x7efdad3b01e1 - sys_common::unwind::try::try_fn::h1335987889750034726
  24:     0x7efdaced98fb - __rust_try
  25:     0x7efdaced1f2d - sys_common::unwind::inner_try::h3542d60f67fb7f36hdt
  26:     0x7efdad3b0a30 - boxed::F.FnBox<A>::call_box::h9171629354063546891
  27:     0x7efdacee3560 - sys::thread::Thread::new::thread_start::h59456e26addaa3d3yWx
  28:     0x7efda56b54a3 - start_thread
  29:     0x7efdacb6213c - clone
  30:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions