Skip to content

Compiler panic #40760

@ineiti

Description

@ineiti

I'm a rust-noob. When compiling my experiments, I get a compiler-panic and it asked me to report here.

I tried this code:

// This probably own't work - I added the "inputs::" myself for reference what is taken below.
pub struct inputs::Element {
    pub source: String,
    pub date: String,
    pub name: String,
}

pub fn new(path: String, inform: Sender<inputs::Element>){
    loop {
        let paths = match fs::read_dir(&path).unwrap(){
            fs::ReadDir(r) => r,
            _ => panic!("Got error while reading {}", &path)
        };

        for p in paths {
            let pa = p.unwrap().path();
            let name = String::from(pa.to_str().unwrap());
            let e = inputs::Element{source: String::from("file:") + &path,
                date: String::from("Constant"), name: name};
            inform.send(e).unwrap();
        }

        thread::sleep(time::Duration::new(1,0));
    }
}

I expected to see this happen: ponies - it compiles!

Instead, this happened:

   Compiling cybermind v0.1.0 (file:///Users/ineiti/IdeaProjects/CyberMind)
     Running `rustc --crate-name cybermind src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=eeee6312c843e5a7 -C extra-filename=-eeee6312c843e5a7 --out-dir /Users/ineiti/IdeaProjects/CyberMind/target/debug/deps -L dependency=/Users/ineiti/IdeaProjects/CyberMind/target/debug/deps`
error: internal compiler error: src/librustc/middle/stability.rs:547: encountered unmarked API
  --> src/inputs/files.rs:16:33
   |
16 |             let pa = p.unwrap().path();
   |                                 ^^^^

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 'Box<Any>', src/librustc_errors/lib.rs:375
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: Could not compile `cybermind`.

Caused by:
  process didn't exit successfully: `rustc --crate-name cybermind src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=eeee6312c843e5a7 -C extra-filename=-eeee6312c843e5a7 --out-dir /Users/ineiti/IdeaProjects/CyberMind/target/debug/deps -L dependency=/Users/ineiti/IdeaProjects/CyberMind/target/debug/deps` (exit code: 101)

Meta

rustc --version --verbose:

rustc 1.16.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-apple-darwin
release: 1.16.0
LLVM version: 3.9

Backtrace:

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:375
stack backtrace:
   1:        0x10e9bf0cc - std::sys::imp::backtrace::tracing::imp::write::h11f6264c06c3c690
   2:        0x10e9cba2e - std::panicking::default_hook::{{closure}}::hcac54d7a3d5c4b83
   3:        0x10e9cb5d3 - std::panicking::default_hook::h5b17330436c00b98
   4:        0x10e9cbee7 - std::panicking::rust_panic_with_hook::h715d6f06ce39d1b2
   5:        0x10be2bd1b - std::panicking::begin_panic::h6a48cb4b1a8bf951
   6:        0x10bfd95a3 - rustc::session::opt_span_bug_fmt::{{closure}}::h80ebd6c236885f5d
   7:        0x10bfd93f9 - rustc::session::opt_span_bug_fmt::hd7f34411b6a25c2f
   8:        0x10bfd9207 - rustc::session::span_bug_fmt::hdfe86a9067534e75
   9:        0x10bfb49d8 - rustc::middle::stability::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::check_stability::hceb9b9cca27cc17f
  10:        0x10b2946c2 - rustc_typeck::check::method::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::lookup_method::hf91914e563f8efe7
  11:        0x10b2e0737 - rustc_typeck::check::FnCtxt::check_expr_kind::h62c70b8e8b437560
  12:        0x10b2ddded - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hca6b8e27e1ae0714
  13:        0x10b2eec27 - rustc_typeck::check::FnCtxt::check_decl_initializer::h28040fc7cd58838a
  14:        0x10b2eed2d - rustc_typeck::check::FnCtxt::check_decl_local::hfff6384269570989
  15:        0x10b2ef066 - rustc_typeck::check::FnCtxt::check_stmt::h7a9d4f0ec3b2a971
  16:        0x10b2ef3ce - rustc_typeck::check::FnCtxt::check_block_with_expected::h953c0a2c08f0272b
  17:        0x10b2de2a4 - rustc_typeck::check::FnCtxt::check_expr_kind::h62c70b8e8b437560
  18:        0x10b2ddded - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hca6b8e27e1ae0714
  19:        0x10b267e50 - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_match::hb4f662d23ea82672
  20:        0x10b2de5b6 - rustc_typeck::check::FnCtxt::check_expr_kind::h62c70b8e8b437560
  21:        0x10b2ddded - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hca6b8e27e1ae0714
  22:        0x10b2ef40e - rustc_typeck::check::FnCtxt::check_block_with_expected::h953c0a2c08f0272b
  23:        0x10b2de450 - rustc_typeck::check::FnCtxt::check_expr_kind::h62c70b8e8b437560
  24:        0x10b2ddded - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hca6b8e27e1ae0714
  25:        0x10b267e50 - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_match::hb4f662d23ea82672
  26:        0x10b2de5b6 - rustc_typeck::check::FnCtxt::check_expr_kind::h62c70b8e8b437560
  27:        0x10b2ddded - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hca6b8e27e1ae0714
  28:        0x10b2eec27 - rustc_typeck::check::FnCtxt::check_decl_initializer::h28040fc7cd58838a
  29:        0x10b2eed2d - rustc_typeck::check::FnCtxt::check_decl_local::hfff6384269570989
  30:        0x10b2ef066 - rustc_typeck::check::FnCtxt::check_stmt::h7a9d4f0ec3b2a971
  31:        0x10b2ef3ce - rustc_typeck::check::FnCtxt::check_block_with_expected::h953c0a2c08f0272b
  32:        0x10b2de2a4 - rustc_typeck::check::FnCtxt::check_expr_kind::h62c70b8e8b437560
  33:        0x10b2ddded - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hca6b8e27e1ae0714
  34:        0x10b2ef000 - rustc_typeck::check::FnCtxt::check_stmt::h7a9d4f0ec3b2a971
  35:        0x10b2ef3ce - rustc_typeck::check::FnCtxt::check_block_with_expected::h953c0a2c08f0272b
  36:        0x10b2de450 - rustc_typeck::check::FnCtxt::check_expr_kind::h62c70b8e8b437560
  37:        0x10b2ddded - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hca6b8e27e1ae0714
  38:        0x10b2ef40e - rustc_typeck::check::FnCtxt::check_block_with_expected::h953c0a2c08f0272b
  39:        0x10b2de2a4 - rustc_typeck::check::FnCtxt::check_expr_kind::h62c70b8e8b437560
  40:        0x10b2ddded - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hca6b8e27e1ae0714
  41:        0x10b2c4fd4 - rustc_typeck::check::check_fn::hcd7f2f03085c6497
  42:        0x10b2c3fde - rustc_typeck::check::check_bare_fn::hb58864524100eeaf
  43:        0x10b2c17ca - rustc_typeck::check::check_item_bodies::hb7db7fdf60331b5f
  44:        0x10b32ca64 - rustc_typeck::check_crate::h688f35d2b29429e7
  45:        0x10aefd040 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::hfe04819b98fd637c
  46:        0x10aee9717 - rustc_driver::driver::phase_3_run_analysis_passes::he434e73ce659d302
  47:        0x10aeced20 - rustc_driver::driver::compile_input::hafc1bdff3e824474
  48:        0x10af1671e - rustc_driver::run_compiler::h28dd1122848b0db9
  49:        0x10ae2e288 - std::panicking::try::do_call::he3322c3e215f35d0
  50:        0x10e9ceafa - __rust_maybe_catch_panic
  51:        0x10ae56ba3 - <F as alloc::boxed::FnBox<A>>::call_box::hb607dad48bf6d166
  52:        0x10e9cab54 - std::sys::imp::thread::Thread::new::thread_start::h598266263fa7f71c
  53:     0x7fff879bb99c - _pthread_body
  54:     0x7fff879bb919 - _pthread_start

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions