diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index dbcc704cbe5..03086444419 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -123,12 +123,10 @@ fn spanned(x: T) -> @ast::spanned { let vi1 = spanned(ast::view_item_use("core", [], n1)); let vi2 = spanned(ast::view_item_import_glob(@["core"], n2)); - let cd1 = spanned(ast::cdir_view_item(vi1)); - let cd2 = spanned(ast::cdir_view_item(vi2)); + let vis = [vi1, vi2] + crate.node.module.view_items; - let cdirs = [cd1, cd2] + crate.node.directives; - - ret @{node: {directives: cdirs with crate.node} with *crate } + ret @{node: {module: { view_items: vis with crate.node.module } + with crate.node} with *crate } } diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index a501d083aae..be3bf5b5ee0 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -60,7 +60,14 @@ tag crate_directive_ { cdir_src_mod(ident, [attribute]); cdir_dir_mod(ident, [@crate_directive], [attribute]); + + // NB: cdir_view_item is *not* processed by the rest of the compiler; the + // attached view_items are sunk into the crate's module during parsing, + // and processed (resolved, imported, etc.) there. This tag-variant exists + // only to preserve the view items in order in case we decide to + // pretty-print crates in the future. cdir_view_item(@view_item); + cdir_syntax(@path); }