Skip to content

Commit

Permalink
auto merge of #12750 : liigo/rust/De-extern-mod, r=alexcrichton
Browse files Browse the repository at this point in the history
rename ast::ViewItemExternMod to ast::ViewItemExternCrate
rename rustdoc::clean::ExternMod to rustdoc::clean::ExternCrate
because `extern mod` is out.
  • Loading branch information
bors committed Mar 7, 2014
2 parents 85ab68e + 2271860 commit b1d104c
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/librustc/front/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Visitor<()> for Context {
}
}
}
ast::ViewItemExternMod(..) => {
ast::ViewItemExternCrate(..) => {
for attr in i.attrs.iter() {
if attr.name().get() == "phase"{
self.gate_feature("phase", attr.span,
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/front/std_inject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn with_version(krate: &str) -> Option<(InternedString, ast::StrStyle)> {
impl fold::Folder for StandardLibraryInjector {
fn fold_crate(&mut self, krate: ast::Crate) -> ast::Crate {
let mut vis = vec!(ast::ViewItem {
node: ast::ViewItemExternMod(token::str_to_ident("std"),
node: ast::ViewItemExternCrate(token::str_to_ident("std"),
with_version("std"),
ast::DUMMY_NODE_ID),
attrs: vec!(
Expand All @@ -90,15 +90,15 @@ impl fold::Folder for StandardLibraryInjector {

if use_uv(&krate) && !self.sess.building_library.get() {
vis.push(ast::ViewItem {
node: ast::ViewItemExternMod(token::str_to_ident("green"),
node: ast::ViewItemExternCrate(token::str_to_ident("green"),
with_version("green"),
ast::DUMMY_NODE_ID),
attrs: Vec::new(),
vis: ast::Inherited,
span: DUMMY_SP
});
vis.push(ast::ViewItem {
node: ast::ViewItemExternMod(token::str_to_ident("rustuv"),
node: ast::ViewItemExternCrate(token::str_to_ident("rustuv"),
with_version("rustuv"),
ast::DUMMY_NODE_ID),
attrs: Vec::new(),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
path_node(~[id_test]),
ast::DUMMY_NODE_ID))))
} else {
ast::ViewItemExternMod(id_test,
ast::ViewItemExternCrate(id_test,
with_version("test"),
ast::DUMMY_NODE_ID)
};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ struct CrateInfo {

fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
match i.node {
ast::ViewItemExternMod(ident, ref path_opt, id) => {
ast::ViewItemExternCrate(ident, ref path_opt, id) => {
let ident = token::get_ident(ident);
debug!("resolving extern crate stmt. ident: {:?} path_opt: {:?}",
ident, path_opt);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {

fn visit_view_item(&mut self, a: &ast::ViewItem, _: ()) {
match a.node {
ast::ViewItemExternMod(..) => {}
ast::ViewItemExternCrate(..) => {}
ast::ViewItemUse(ref uses) => {
for vpath in uses.iter() {
match vpath.node {
Expand Down Expand Up @@ -976,7 +976,7 @@ impl Visitor<()> for SanePrivacyVisitor {
reachable");
} else {
match i.node {
ast::ViewItemExternMod(..) => {
ast::ViewItemExternCrate(..) => {
self.tcx.sess.span_err(i.span, "`pub` visibility \
is not allowed");
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ impl Resolver {
}
}

ViewItemExternMod(name, _, node_id) => {
ViewItemExternCrate(name, _, node_id) => {
// n.b. we don't need to look at the path option here, because cstore already did
match self.session.cstore.find_extern_mod_stmt_cnum(node_id) {
Some(crate_id) => {
Expand Down Expand Up @@ -5415,7 +5415,7 @@ impl Resolver {
if vi.span == DUMMY_SP { return }

match vi.node {
ViewItemExternMod(..) => {} // ignore
ViewItemExternCrate(..) => {} // ignore
ViewItemUse(ref path) => {
for p in path.iter() {
match p.node {
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,19 +1066,19 @@ impl Clean<Item> for ast::ViewItem {

#[deriving(Clone, Encodable, Decodable)]
pub enum ViewItemInner {
ExternMod(~str, Option<~str>, ast::NodeId),
ExternCrate(~str, Option<~str>, ast::NodeId),
Import(~[ViewPath])
}

impl Clean<ViewItemInner> for ast::ViewItem_ {
fn clean(&self) -> ViewItemInner {
match self {
&ast::ViewItemExternMod(ref i, ref p, ref id) => {
&ast::ViewItemExternCrate(ref i, ref p, ref id) => {
let string = match *p {
None => None,
Some((ref x, _)) => Some(x.get().to_owned()),
};
ExternMod(i.clean(), string, *id)
ExternCrate(i.clean(), string, *id)
}
&ast::ViewItemUse(ref vp) => {
Import(vp.clean().move_iter().collect())
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,8 @@ fn item_module(w: &mut Writer, cx: &Context,
match (&i1.inner, &i2.inner) {
(&clean::ViewItemItem(ref a), &clean::ViewItemItem(ref b)) => {
match (&a.inner, &b.inner) {
(&clean::ExternMod(..), _) => Less,
(_, &clean::ExternMod(..)) => Greater,
(&clean::ExternCrate(..), _) => Less,
(_, &clean::ExternCrate(..)) => Greater,
_ => idx1.cmp(&idx2),
}
}
Expand Down Expand Up @@ -1056,7 +1056,7 @@ fn item_module(w: &mut Writer, cx: &Context,

clean::ViewItemItem(ref item) => {
match item.inner {
clean::ExternMod(ref name, ref src, _) => {
clean::ExternCrate(ref name, ref src, _) => {
try!(write!(w, "<tr><td><code>extern crate {}",
name.as_slice()));
match *src {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/visit_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<'a> RustdocVisitor<'a> {
}
}
}
ast::ViewItemExternMod(..) => item.clone()
ast::ViewItemExternCrate(..) => item.clone()
};
om.view_items.push(item);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ pub enum ViewItem_ {
// optional (InternedString,StrStyle): if present, this is a location
// (containing arbitrary characters) from which to fetch the crate sources
// For example, extern crate whatever = "github.com/mozilla/rust"
ViewItemExternMod(Ident, Option<(InternedString,StrStyle)>, NodeId),
ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId),
ViewItemUse(Vec<@ViewPath> ),
}

Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ast_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> {

fn visit_view_item(&mut self, view_item: &ViewItem, env: ()) {
match view_item.node {
ViewItemExternMod(_, _, node_id) => {
ViewItemExternCrate(_, _, node_id) => {
self.operation.visit_id(node_id)
}
ViewItemUse(ref view_paths) => {
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ pub fn expand_view_item(vi: &ast::ViewItem,
fld: &mut MacroExpander)
-> ast::ViewItem {
match vi.node {
ast::ViewItemExternMod(..) => {
ast::ViewItemExternCrate(..) => {
let should_load = vi.attrs.iter().any(|attr| {
attr.name().get() == "phase" &&
attr.meta_item_list().map_or(false, |phases| {
Expand All @@ -446,7 +446,7 @@ fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) {
let MacroCrate { lib, cnum } = fld.cx.ecfg.loader.load_crate(krate);

let crate_name = match krate.node {
ast::ViewItemExternMod(name, _, _) => name,
ast::ViewItemExternCrate(name, _, _) => name,
_ => unreachable!()
};
let name = format!("<{} macros>", token::get_ident(crate_name));
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ fn fold_variant_arg_<T: Folder>(va: &VariantArg, folder: &mut T) -> VariantArg {
pub fn noop_fold_view_item<T: Folder>(vi: &ViewItem, folder: &mut T)
-> ViewItem{
let inner_view_item = match vi.node {
ViewItemExternMod(ref ident, ref string, node_id) => {
ViewItemExternMod(ident.clone(),
ViewItemExternCrate(ref ident, ref string, node_id) => {
ViewItemExternCrate(ident.clone(),
(*string).clone(),
folder.new_id(node_id))
}
Expand Down
8 changes: 4 additions & 4 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use ast::{TyInfer, TypeMethod};
use ast::{TyNil, TyParam, TyParamBound, TyPath, TyPtr, TyRptr};
use ast::{TyTup, TyU32, TyUniq, TyVec, UnUniq};
use ast::{UnnamedField, UnsafeBlock, UnsafeFn, ViewItem};
use ast::{ViewItem_, ViewItemExternMod, ViewItemUse};
use ast::{ViewItem_, ViewItemExternCrate, ViewItemUse};
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
use ast::Visibility;
use ast;
Expand Down Expand Up @@ -4361,7 +4361,7 @@ impl Parser {
};

IoviViewItem(ast::ViewItem {
node: ViewItemExternMod(ident, maybe_path, ast::DUMMY_NODE_ID),
node: ViewItemExternCrate(ident, maybe_path, ast::DUMMY_NODE_ID),
attrs: attrs,
vis: visibility,
span: mk_sp(lo, self.last_span.hi)
Expand Down Expand Up @@ -5017,11 +5017,11 @@ impl Parser {
// `extern crate` must precede `use`.
extern_mod_allowed = false;
}
ViewItemExternMod(..) if !extern_mod_allowed => {
ViewItemExternCrate(..) if !extern_mod_allowed => {
self.span_err(view_item.span,
"\"extern crate\" declarations are not allowed here");
}
ViewItemExternMod(..) => {}
ViewItemExternCrate(..) => {}
}
view_items.push(view_item);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,7 @@ pub fn print_view_item(s: &mut State, item: &ast::ViewItem) -> io::IoResult<()>
try!(print_outer_attributes(s, item.attrs.as_slice()));
try!(print_visibility(s, item.vis));
match item.node {
ast::ViewItemExternMod(id, ref optional_path, _) => {
ast::ViewItemExternCrate(id, ref optional_path, _) => {
try!(head(s, "extern crate"));
try!(print_ident(s, id));
for &(ref p, style) in optional_path.iter() {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub fn walk_mod<E: Clone, V: Visitor<E>>(visitor: &mut V, module: &Mod, env: E)

pub fn walk_view_item<E: Clone, V: Visitor<E>>(visitor: &mut V, vi: &ViewItem, env: E) {
match vi.node {
ViewItemExternMod(name, _, _) => {
ViewItemExternCrate(name, _, _) => {
visitor.visit_ident(vi.span, name, env)
}
ViewItemUse(ref paths) => {
Expand Down

0 comments on commit b1d104c

Please sign in to comment.