[rust-dev] Using rustc as crate?

Brandon Sanderson singingboyo at gmail.com
Sat Jul 12 06:37:37 PDT 2014


I haven't done anything like this myself, so I can't say if the lints are
intended to be used outside the compiler.  However, I think your problem is
just a missing rustc:: at the start of your imports.  You probably want
'use rustc::middle::typeck::infer', for example.

Also, it is possible to get cargo working on windows, or at least it was.
 I do have a working (old-ish) version that I use regularly.  I haven't
tried updating it recently, however.


On Sat, Jul 12, 2014 at 6:27 AM, Christoph Husse <
thesaint1987 at googlemail.com> wrote:

> Hi,
>
> I am trying to "externalize" the builtin Lint code, because I want to
> work on some tooling support and they seem to do a lot of the stuff I
> would be interested in too..
>
> But I don't want to recompile rustc for every change to my code. I
> noticed most of the mods are public but still rust doesn't seem to let
> me import them into my own crate.
>
> I just wrote something like the following for testing:
>
> ####################################################
>
> #![crate_name = "rusttooling"]
> #![experimental]
> #![comment = "The Rust Tooling Library"]
> #![license = "MIT/ASL2"]
> #![crate_type = "dylib"]
> #![crate_type = "rlib"]
> #![doc(html_logo_url =
> "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
>       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
>       html_root_url = "http://doc.rust-lang.org/0.11.0/")]
>
> #![allow(deprecated)]
> #![feature(macro_rules, globs, struct_variant, managed_boxes, quote)]
> #![feature(default_type_params, phase, unsafe_destructor)]
>
> #![allow(unknown_features)] // NOTE: Remove after next snapshot
> #![feature(rustc_diagnostic_macros)]
>
> extern crate arena;
> extern crate rustc;
> extern crate debug;
> extern crate flate;
> extern crate getopts;
> extern crate graphviz;
> extern crate libc;
> extern crate serialize;
> extern crate time;
> #[phase(plugin, link)] extern crate log;
> #[phase(plugin, link)] extern crate syntax;
>
>
> //pub mod lint;
> use middle::typeck::infer;
> use metadata::csearch;
>
>
> ####################################################
>
> The last two lines fail for me... "error: unresolved import
> `middle::typeck::infer`. Maybe a missing `extern crate middle`?"
>
> What could be the problem?
> Was it intended for Lint like stuff to even be used outside the compiler?
> How would the "officially" supported way look like?
>
> PS: I am on windows and the cargo thing doesn't seem to work there yet.
>
> Thanks a lot!
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140712/977b294b/attachment.html>


More information about the Rust-dev mailing list