<p dir="auto"><code class="notranslate">rustc 0.13.0-nightly (81eeec094 2014-11-21 23:16:48 +0000) binary: rustc commit-hash: 81eeec0941f936f0f3de881c3991a74f32fe0625 commit-date: 2014-11-21 23:16:48 +0000 host: x86_64-unknown-linux-gnu release: 0.13.0-nightly</code></p>
<p dir="auto">When trying to comile a lib with with a binary (main.rs or in examples forlder), I get this error :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Compiling rgil v0.0.1 (file:///home/moi/dev/rust/rgil)
     Running `rustc /home/moi/dev/rust/rgil/src/main.rs --crate-name rgil --crate-type bin -g --out-dir /home/moi/dev/rust/rgil/target --dep-info /home/moi/dev/rust/rgil/target/.fingerprint/rgil-e6254dbc5a554d2a/dep-bin-rgil -L /home/moi/dev/rust/rgil/target -L /home/moi/dev/rust/rgil/target/deps --extern rgil=/home/moi/dev/rust/rgil/target/librgil-e6254dbc5a554d2a.rlib`
ERROR:rbml::::reader: failed to find block with tag 1
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'explicit panic', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librbml/lib.rs:251

stack backtrace:
   1:     0x7fa1c547a010 - rt::backtrace::imp::write::hef97d2b7b4481e2fW6s
   2:     0x7fa1c547d0e0 - failure::on_fail::h9b598fcb939318f7Bxt
   3:     0x7fa1c50dc640 - unwind::begin_unwind_inner::hf72462897f10dfac4ad
   4:     0x7fa1bf273ab0 - unwind::begin_unwind::h2477909393494085412
   5:     0x7fa1bf2724f0 - reader::get_doc::h17e37966410128a9jSa
   6:     0x7fa1c44a19c0 - metadata::decoder::item_name::h35506fce3791599dmyU
   7:     0x7fa1c44ab080 - metadata::decoder::get_trait_item_name_and_kind::hbde287441338672947U
   8:     0x7fa1c3f3ac50 - metadata::csearch::get_trait_item_name_and_kind::he798b7880cd312c89tX
   9:     0x7fa1c3f3ae70 - middle::resolve::Resolver&lt;'a&gt;::build_reduced_graph_for_external_crate_def::hdc699fc69e55a418A9G
  10:     0x7fa1c3f3da20 - middle::resolve::Resolver&lt;'a&gt;::populate_external_module::closure.95307
  11:     0x7fa1c44a6e60 - metadata::decoder::each_child_of_item_or_crate::closure.125452
  12:     0x7fa1bf2740d0 - reader::tagged_docs::h38a72f870a187e73HZa
  13:     0x7fa1c44a6b60 - metadata::decoder::each_child_of_item_or_crate::h096cc9a66bdc62d5xKU
  14:     0x7fa1c44a7d10 - metadata::decoder::each_child_of_item::hf661713e5e2bce02kRU
  15:     0x7fa1c3f3d710 - metadata::csearch::each_child_of_item::h590bc69906520a6dinX
  16:     0x7fa1c3f3dbf0 - middle::resolve::Resolver&lt;'a&gt;::populate_module_if_necessary::h3e2306d524bdaf74MoH
  17:     0x7fa1c3f65fa0 - middle::resolve::Resolver&lt;'a&gt;::resolve_definition_of_name_in_module::ha0855d5707f7090dkbM
  18:     0x7fa1c3f5d8d0 - middle::resolve::Resolver&lt;'a&gt;::resolve_path::hc7825469530d3e3e87L
  19:     0x7fa1c3f20e80 - middle::resolve::Resolver&lt;'a&gt;::resolve_expr::ha9dc140cb9c037819IM
  20:     0x7fa1c3f24160 - middle::resolve::Resolver&lt;'a&gt;::resolve_local::h724af94d928308e1wmL
  21:     0x7fa1c3f20800 - middle::resolve::Resolver&lt;'a&gt;::resolve_block::hd0b9bc7a03ee83f2fuL
  22:     0x7fa1c3f5d4b0 - middle::resolve::Resolver&lt;'a&gt;::resolve_function::closure.95930
  23:     0x7fa1c3f39560 - middle::resolve::Resolver&lt;'a&gt;::with_type_parameter_rib::h4947f1b41a0d0483zPK
  24:     0x7fa1c3f5b780 - middle::resolve::Resolver&lt;'a&gt;::resolve_function::h684365f88b82ece2pVK
  25:     0x7fa1c3f1f0b0 - middle::resolve::Resolver&lt;'a&gt;.Visitor&lt;'v&gt;::visit_item::h48e76a19234d4163E3E
  26:     0x7fa1c3f69da0 - middle::resolve::resolve_crate::h4a55e9223e2db574ABN
  27:     0x7fa1c5a10840 - driver::driver::phase_3_run_analysis_passes::ha8b8102919fdb48e2eS
  28:     0x7fa1c5a05710 - driver::driver::compile_input::hbd4bc05bf55cdd378VR
  29:     0x7fa1c5a89d50 - driver::run_compiler::he46ab51e5afb31a4gUT
  30:     0x7fa1c5a89c40 - driver::run::closure.59674
  31:     0x7fa1c5896dc0 - task::TaskBuilder::try_future::closure.38929
  32:     0x7fa1c5407fb0 - task::TaskBuilder::spawn_internal::closure.24286
  33:     0x7fa1c50da100 - task::Task::spawn::closure.6102
  34:     0x7fa1c5134560 - rust_try_inner
  35:     0x7fa1c5134550 - rust_try
  36:     0x7fa1c50da1e0 - unwind::try::h7e59352c5994e9d5pZc
  37:     0x7fa1c50d9fa0 - task::Task::run::hf30215495b09adaey6b
  38:     0x7fa1c50d9b90 - task::Task::spawn::closure.6078
  39:     0x7fa1c50db940 - thread::thread_start::ha9152079db62ba4dlqc
  40:     0x7fa1bfbc80c0 - start_thread
  41:     0x7fa1c4da0f89 - __clone
  42:                0x0 - &lt;unknown&gt;

Could not compile `rgil`.

Caused by:
  Process didn't exit successfully: `rustc /home/moi/dev/rust/rgil/src/main.rs --crate-name rgil --crate-type bin -g --out-dir /home/moi/dev/rust/rgil/target --dep-info /home/moi/dev/rust/rgil/target/.fingerprint/rgil-e6254dbc5a554d2a/dep-bin-rgil -L /home/moi/dev/rust/rgil/target -L /home/moi/dev/rust/rgil/target/deps --extern rgil=/home/moi/dev/rust/rgil/target/librgil-e6254dbc5a554d2a.rlib` (status=101)

shell returned 101"><pre class="notranslate"><code class="notranslate">Compiling rgil v0.0.1 (file:///home/moi/dev/rust/rgil)
     Running `rustc /home/moi/dev/rust/rgil/src/main.rs --crate-name rgil --crate-type bin -g --out-dir /home/moi/dev/rust/rgil/target --dep-info /home/moi/dev/rust/rgil/target/.fingerprint/rgil-e6254dbc5a554d2a/dep-bin-rgil -L /home/moi/dev/rust/rgil/target -L /home/moi/dev/rust/rgil/target/deps --extern rgil=/home/moi/dev/rust/rgil/target/librgil-e6254dbc5a554d2a.rlib`
ERROR:rbml::::reader: failed to find block with tag 1
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'explicit panic', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librbml/lib.rs:251

stack backtrace:
   1:     0x7fa1c547a010 - rt::backtrace::imp::write::hef97d2b7b4481e2fW6s
   2:     0x7fa1c547d0e0 - failure::on_fail::h9b598fcb939318f7Bxt
   3:     0x7fa1c50dc640 - unwind::begin_unwind_inner::hf72462897f10dfac4ad
   4:     0x7fa1bf273ab0 - unwind::begin_unwind::h2477909393494085412
   5:     0x7fa1bf2724f0 - reader::get_doc::h17e37966410128a9jSa
   6:     0x7fa1c44a19c0 - metadata::decoder::item_name::h35506fce3791599dmyU
   7:     0x7fa1c44ab080 - metadata::decoder::get_trait_item_name_and_kind::hbde287441338672947U
   8:     0x7fa1c3f3ac50 - metadata::csearch::get_trait_item_name_and_kind::he798b7880cd312c89tX
   9:     0x7fa1c3f3ae70 - middle::resolve::Resolver&lt;'a&gt;::build_reduced_graph_for_external_crate_def::hdc699fc69e55a418A9G
  10:     0x7fa1c3f3da20 - middle::resolve::Resolver&lt;'a&gt;::populate_external_module::closure.95307
  11:     0x7fa1c44a6e60 - metadata::decoder::each_child_of_item_or_crate::closure.125452
  12:     0x7fa1bf2740d0 - reader::tagged_docs::h38a72f870a187e73HZa
  13:     0x7fa1c44a6b60 - metadata::decoder::each_child_of_item_or_crate::h096cc9a66bdc62d5xKU
  14:     0x7fa1c44a7d10 - metadata::decoder::each_child_of_item::hf661713e5e2bce02kRU
  15:     0x7fa1c3f3d710 - metadata::csearch::each_child_of_item::h590bc69906520a6dinX
  16:     0x7fa1c3f3dbf0 - middle::resolve::Resolver&lt;'a&gt;::populate_module_if_necessary::h3e2306d524bdaf74MoH
  17:     0x7fa1c3f65fa0 - middle::resolve::Resolver&lt;'a&gt;::resolve_definition_of_name_in_module::ha0855d5707f7090dkbM
  18:     0x7fa1c3f5d8d0 - middle::resolve::Resolver&lt;'a&gt;::resolve_path::hc7825469530d3e3e87L
  19:     0x7fa1c3f20e80 - middle::resolve::Resolver&lt;'a&gt;::resolve_expr::ha9dc140cb9c037819IM
  20:     0x7fa1c3f24160 - middle::resolve::Resolver&lt;'a&gt;::resolve_local::h724af94d928308e1wmL
  21:     0x7fa1c3f20800 - middle::resolve::Resolver&lt;'a&gt;::resolve_block::hd0b9bc7a03ee83f2fuL
  22:     0x7fa1c3f5d4b0 - middle::resolve::Resolver&lt;'a&gt;::resolve_function::closure.95930
  23:     0x7fa1c3f39560 - middle::resolve::Resolver&lt;'a&gt;::with_type_parameter_rib::h4947f1b41a0d0483zPK
  24:     0x7fa1c3f5b780 - middle::resolve::Resolver&lt;'a&gt;::resolve_function::h684365f88b82ece2pVK
  25:     0x7fa1c3f1f0b0 - middle::resolve::Resolver&lt;'a&gt;.Visitor&lt;'v&gt;::visit_item::h48e76a19234d4163E3E
  26:     0x7fa1c3f69da0 - middle::resolve::resolve_crate::h4a55e9223e2db574ABN
  27:     0x7fa1c5a10840 - driver::driver::phase_3_run_analysis_passes::ha8b8102919fdb48e2eS
  28:     0x7fa1c5a05710 - driver::driver::compile_input::hbd4bc05bf55cdd378VR
  29:     0x7fa1c5a89d50 - driver::run_compiler::he46ab51e5afb31a4gUT
  30:     0x7fa1c5a89c40 - driver::run::closure.59674
  31:     0x7fa1c5896dc0 - task::TaskBuilder::try_future::closure.38929
  32:     0x7fa1c5407fb0 - task::TaskBuilder::spawn_internal::closure.24286
  33:     0x7fa1c50da100 - task::Task::spawn::closure.6102
  34:     0x7fa1c5134560 - rust_try_inner
  35:     0x7fa1c5134550 - rust_try
  36:     0x7fa1c50da1e0 - unwind::try::h7e59352c5994e9d5pZc
  37:     0x7fa1c50d9fa0 - task::Task::run::hf30215495b09adaey6b
  38:     0x7fa1c50d9b90 - task::Task::spawn::closure.6078
  39:     0x7fa1c50db940 - thread::thread_start::ha9152079db62ba4dlqc
  40:     0x7fa1bfbc80c0 - start_thread
  41:     0x7fa1c4da0f89 - __clone
  42:                0x0 - &lt;unknown&gt;

Could not compile `rgil`.

Caused by:
  Process didn't exit successfully: `rustc /home/moi/dev/rust/rgil/src/main.rs --crate-name rgil --crate-type bin -g --out-dir /home/moi/dev/rust/rgil/target --dep-info /home/moi/dev/rust/rgil/target/.fingerprint/rgil-e6254dbc5a554d2a/dep-bin-rgil -L /home/moi/dev/rust/rgil/target -L /home/moi/dev/rust/rgil/target/deps --extern rgil=/home/moi/dev/rust/rgil/target/librgil-e6254dbc5a554d2a.rlib` (status=101)

shell returned 101
</code></pre></div>
<p dir="auto">I am not sure what the chances are, but if it could be improved, it should be before 1.0.<br>
Rust's module system has a steep learning/doing curve. I think there are two reasons for this:</p>
<ol dir="auto">
<li>Importing functionality and importing namespace are two steps: <code class="notranslate">mod</code> and <code class="notranslate">use</code>. This leads to the shadowing rules, that have weird consequences: you need to import a path via <code class="notranslate">use</code> which is not even defined at this point in time, because <code class="notranslate">use</code> needs to before <code class="notranslate">mod</code>. I find this not only unfamiliar but also counterintuitive.</li>
<li>The compiled file becomes a crate. In most languages you can iteratively compose a project of files/modules and use/compile those individually. Since <code class="notranslate">use</code> statements are relative to the crate, the meaning changes depending on which file you currently compile. The consequence is that it makes it more difficult than necessary to first write file <code class="notranslate">a.rs</code>, then <code class="notranslate">b.rs</code> (uses <code class="notranslate">a.rs</code>), and then <code class="notranslate">c.rs</code> (uses <code class="notranslate">b.rs</code>) and make them compile individually. Even in Haskell that is easy. In Rust you either have to go back and forth and adjust the <code class="notranslate">use</code>-staments or only put the <code class="notranslate">mod</code>-statements in a dedicated top-level crate (<code class="notranslate">lib.rs</code> or <code class="notranslate">main.rs</code>) which defies encapsulation.</li>
</ol>
<p dir="auto">This could be an issue that is fixable with more/better documentation. However, when you need a lot of words/actions to describe/do something in one system which does not need that care in another system, that could be an indication that there is some accidental complexity. I think this complexity is accidental since i am not yet aware of which gains are compensating for this.</p>