Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Closed
JDemler opened this issue Feb 16, 2016 · 2 comments

Comments

@JDemler
Copy link
Contributor

JDemler commented Feb 16, 2016

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>
@alexcrichton
Copy link
Member

cc @jseyfried

@jseyfried
Copy link
Contributor

Reduced example:

mod foo { use foo::bar; }

fn main() { foo::bar() }

This panics when we try to compute LastPrivate data for foo::bar in main because PR #31338 defines bar to be Def::Err, which has diverging def_id.

Manishearth added a commit to Manishearth/rust that referenced this issue Mar 12, 2016
cleanups and fixes for #[derive]

This contains a bunch of little cleanups and fixes to `#[derive]`. There are more extensive comments on each individual commit.

- hygiene cleanups
- use `discriminant_value` instead of variant index in `#[derive(Hash)]`
- ~~don't move out of borrowed content in `#[derive(PartialOrd, PartialEq)]`~~
- use `intrinsics::unreachable()` instead of `unreachable!()`

I don't believe there are any breaking changes in here, but I do want some more eyes on that.

Fixes rust-lang#2810 (!), I believe (we still assume that "std" or "core" is the standard library but so does the rest of rustc...).
Fixes rust-lang#21714 (cc @apasel422).
~~Fixes~~ (postponed) rust-lang#24047 (cc @withoutboats @bluss).
Fixes rust-lang#31714 (cc @alexcrichton @bluss).
Fixes rust-lang#31886 (cc @oli-obk).
bors added a commit that referenced this issue Mar 13, 2016
cleanups and fixes for #[derive]

This contains a bunch of little cleanups and fixes to `#[derive]`. There are more extensive comments on each individual commit.

- hygiene cleanups
- use `discriminant_value` instead of variant index in `#[derive(Hash)]`
- ~~don't move out of borrowed content in `#[derive(PartialOrd, PartialEq)]`~~
- use `intrinsics::unreachable()` instead of `unreachable!()`

I don't believe there are any breaking changes in here, but I do want some more eyes on that.

Fixes #2810 (!), I believe (we still assume that "std" or "core" is the standard library but so does the rest of rustc...).
Fixes #21714 (cc @apasel422).
~~Fixes~~ (postponed) #24047 (cc @withoutboats @bluss).
Fixes #31714 (cc @alexcrichton @bluss).
Fixes #31886 (cc @oli-obk).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants