Compler error re: serialize


Hello All,

I’m trying to compile and run the program found here:

Line 6 is: extern crate “rustc-serialize” as rustc_serialize;

Error when trying to compile is:
error: expected identifier, found "rustc-serialize"
6 | extern crate “rustc-serialize” as rustc_serialize;
| ^^^^^^^^^^^^^^^^^

error: aborting due to previous error

My searches online show that there have been issues with serialize, but I haven’t found how to make this work.

Suggestions/solutions are much appreciated.


NB running Rust version: rustc 1.20.0 (f3d6973f4 2017-08-27) on Ubuntu 16.0.4


The extern crate argument is an identifier, not a string, in this case it should be extern crate rustc-serialize (as is not needed here). However - why you would to use deprecated crate, when the supported replacement is visible in README which is rendered both on github and


That code is 3 years old, from before the Rust 1.0 release.


Thanks for getting back to me.
When I change the line from extern crate “rustc-serialize” as rustc_serialize; to extern crate rustc-serialize;
I get another error:

error : expected one of ; or as, found -

6 | extern crate rustc-serialize;

^ expected one of ; or as here

error : aborting due to previous error

When I try extern crate rustc_serialize;
I get another error:

error[E0463] : can’t find crate for docopt_macros

2 | #![plugin(docopt_macros)]

^^^^^^^^^^^^^ can’t find crate

error : aborting due to previous error

Please note that I just picked up Rust yesterday and don’t yet know how to use the available resources to solve this problem.

Thanks again,



You should look into serde for serialization needs and into clap for cmdline arg parsing. Both are crates available on


Thanks very much for your feedback.

Looks like both e xtern crate rustc-serialize and e xtern crate serde
prevent compiler error.

Haven’t solved the error[E0463] : can’t find crate for docopt_macros yet.

And yes the code is a few years old–a long time for rapidly evolving language.
Would it be possible to install a version of rust from 2015 that would compile and run without errors?
This approach would have the advantage of getting the program working.

Thanks again,



So you should switch to serde here and forget rustc-serialize.

And use clap instead of docopt for cmdline arg parsing.

I would strongly recommend that you get the code working on current Rust. There’s little point making it work on a 2+ yrs old version and you’re unlikely to receive help from the community on such an old version.