A new error


#1

So I spent a very long time today trying to work out why a local crate was not importing properly.

The only message I got was not found in {{root}} but I knew it was in there.

It turned out to be a bin not a library. It could have spared me a lot of pain if there was a “crate is not a library” error.

I may not have been bright about this but I doubt I’ll be the only one it helps.

Thanks.


#2

If you write up simple instructions on how to reproduce this, the Rust team would be grateful for an issue filed on github.


#3

@storyfeet Rustc doesn’t know about the existence of executables, because cargo doesn’t tell it about that. Doing so would give:

echo "extern crate abc;" | rustc --extern abc=$(where rustc) -                       bjorn@iMac
error[E0463]: can't find crate for `abc`
 --> <anon>:1:1
  |
1 | extern crate abc;
  | ^^^^^^^^^^^^^^^^^ can't find crate
  |
  = note: extern location for abc is of an unknown type: /Users/bjorn/.cargo/bin/rustc
  = help: file name should be lib*.rlib or lib*..dylib

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.