1
Fork 0

auto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichton

The first setp for #9880 is to add a new `crate` keyword. This PR does exactly that. I took a chance to refactor `parse_item_foreign_mod` and I broke it down into 2 separate methods to isolate each feature.

The next step will be to push a new stage0 snapshot and then get rid of all `extern mod` around the code.
This commit is contained in:
bors 2014-02-13 16:32:01 -08:00
commit 89b1686bd7
76 changed files with 618 additions and 590 deletions

View file

@ -160,10 +160,10 @@ fn resolved_path(w: &mut io::Writer, id: ast::NodeId, p: &clean::Path,
/// will invoke `path` with proper linking-style arguments.
fn external_path(w: &mut io::Writer, p: &clean::Path, print_all: bool,
fqn: &[~str], kind: clean::TypeKind,
crate: ast::CrateNum) -> fmt::Result {
krate: ast::CrateNum) -> fmt::Result {
path(w, p, print_all,
|cache, loc| {
match *cache.extern_locations.get(&crate) {
match *cache.extern_locations.get(&krate) {
render::Remote(ref s) => Some(s.clone()),
render::Local => Some("../".repeat(loc.len())),
render::Unknown => None,
@ -310,9 +310,9 @@ impl fmt::Show for clean::Type {
typarams(f.buf, tp)
}
clean::ExternalPath{path: ref path, typarams: ref tp,
fqn: ref fqn, kind, crate} => {
fqn: ref fqn, kind, krate} => {
if_ok!(external_path(f.buf, path, false, fqn.as_slice(), kind,
crate))
krate))
typarams(f.buf, tp)
}
clean::Self(..) => f.buf.write("Self".as_bytes()),