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

Unexpected definition for an identifier in pattern Err #34933

Closed
Thinkofname opened this issue Jul 20, 2016 · 3 comments
Closed

Unexpected definition for an identifier in pattern Err #34933

Thinkofname opened this issue Jul 20, 2016 · 3 comments

Comments

@Thinkofname
Copy link

Thinkofname commented Jul 20, 2016

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: run with `RUST_BACKTRACE=1` for a backtrace 
thread 'rustc' panicked at '../src/librustc_resolve/lib.rs:2356: unexpected definition for an identifier in pattern Err', ../src/librustc/session/mod.rs:645
stack backtrace:
   1:     0x7f76eb31c12f - std::sys::backtrace::tracing::imp::write::h29f5fdb9fc0a7395
   2:     0x7f76eb3337fb - std::panicking::default_hook::_{{closure}}::h2cc84f0378700526
   3:     0x7f76eb32c377 - std::panicking::default_hook::hbbe7fa36a995aca0
   4:     0x7f76eb32ca9c - std::panicking::rust_panic_with_hook::h105c3d42fcd2fb5e
   5:     0x7f76ea8551f1 - std::panicking::begin_panic::hbf62ea4a5ff3f9de
   6:     0x7f76ea8ba624 - rustc::session::opt_span_bug_fmt::_{{closure}}::h62b0957667555cfe
   7:     0x7f76e82459cf - rustc::session::span_bug_fmt::hcdfbe9cf944f6fc3
   8:     0x7f76e82acdf3 - rustc_resolve::Resolver::resolve_pattern::_{{closure}}::_{{closure}}::hb7b740e316c3c0d0
   9:     0x7f76e82b1146 - rustc_resolve::Resolver::resolve_pattern::_{{closure}}::h07300d27c945a906
  10:     0x7f76e8256448 - syntax::ast::Pat::walk::h1484712129603134
  11:     0x7f76e8296cb2 - rustc_resolve::Resolver::resolve_function::h2a7b902c2b6958af
  12:     0x7f76e8269a58 - syntax::visit::walk_impl_item::h8bc6dcab3e98d366
  13:     0x7f76e82bd0a9 - rustc_resolve::Resolver::resolve_implementation::_{{closure}}::_{{closure}}::_{{closure}}::_{{closure}}::h484fc0970900fda7
  14:     0x7f76e8297281 - rustc_resolve::Resolver::with_current_self_type::hf92c74c5ea1895c1
  15:     0x7f76e8297dfe - rustc_resolve::Resolver::with_self_rib::h43557df3fff66562
  16:     0x7f76e8297962 - rustc_resolve::Resolver::with_optional_trait_ref::h8d15622d53ad887a
  17:     0x7f76e82951ae - rustc_resolve::Resolver::resolve_item::hf44c6991ef672266
  18:     0x7f76e826c6cf - syntax::visit::walk_item::h2160a748780131f2
  19:     0x7f76e8294d80 - rustc_resolve::Resolver::resolve_item::hf44c6991ef672266
  20:     0x7f76e826c6cf - syntax::visit::walk_item::h2160a748780131f2
  21:     0x7f76e8294d80 - rustc_resolve::Resolver::resolve_item::hf44c6991ef672266
  22:     0x7f76e829075e - rustc_resolve::Resolver::resolve_crate::h4fdbe2c5a29bae4d
  23:     0x7f76eb933577 - rustc_driver::driver::phase_2_configure_and_expand::_{{closure}}::h7f9235d9e9fe0dc9
  24:     0x7f76eb8e5b52 - rustc_driver::driver::phase_2_configure_and_expand::h23617908add5ca02
  25:     0x7f76eb8d89b7 - rustc_driver::driver::compile_input::hb4cc34cf85dc1edf
  26:     0x7f76eb90344c - rustc_driver::run_compiler::h50f95674bd902ab5
  27:     0x7f76eb96eb28 - rustc_driver::run::_{{closure}}::h578f58fb80a79b9c
  28:     0x7f76eb9699cb - rustc_driver::monitor::_{{closure}}::he296944eac047e81
  29:     0x7f76eb86d9fd - std::panicking::try::call::h4577500a5284c6ff
  30:     0x7f76eb34187b - __rust_try
  31:     0x7f76eb34175e - __rust_maybe_catch_panic
  32:     0x7f76eb918e4d - std::thread::Builder::spawn::_{{closure}}::haaf8628155e4305c
  33:     0x7f76eb88784e - _<F as alloc..boxed..FnBox<A>>::call_box::h24f3eb0b42327962
  34:     0x7f76eb32a2c4 - std::sys::thread::Thread::new::thread_start::h8f3bd45211e9f5ea
  35:     0x7f76e2712183 - start_thread
  36:     0x7f76eaf5337c - clone
  37:                0x0 - <unknown>

Happened on a private project so I can't release the source and I haven't been able to reduce it down to a small test case yet. It happened when I removed a large number of modules to move into a crate without updating the uses.

rustc 1.12.0-nightly (34f35ed29 2016-07-17)
binary: rustc
commit-hash: 34f35ed29c8acdbe1e3c172786fc41d6f4fb6090
commit-date: 2016-07-17
host: x86_64-unknown-linux-gnu
release: 1.12.0-nightly
@Thinkofname
Copy link
Author

This actually triggers #34929 on beta so chances are they are the same issue or at least related?

@Thinkofname
Copy link
Author

Thinkofname commented Jul 20, 2016

And a test case: https://is.gd/tDdrzI

use missing;

impl Test {
    pub fn test(&self, missing: &A) -> Option<Vec<missing::B>> {
        match *missing {
            A::Missing{keycode, ..} => {
                unimplemented!()
            },
            _ => {}
        }
        None
    }
}

The reduced case doesn't trigger #34929 so it was most likely me running into two bugs at once.

Beta and stable don't show the issue only nightly

@petrochenkov
Copy link
Contributor

And a test case: https://is.gd/tDdrzI

Interesting, thanks.
I didn't expect resolve_identifier to return Def::Err, but it can happen with import error recovery, as your example shows. I'll fix this.

Manishearth added a commit to Manishearth/rust that referenced this issue Jul 28, 2016
resolve: Fix ICE and extra diagnostics happening when unresolved imports are used in patterns

Closes rust-lang#34933

r? @jseyfried
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

No branches or pull requests

2 participants