Skip to content

Commit a10aec6

Browse files
committed
Auto merge of #26141 - eddyb:ast_map, r=nikomatsakis
Gets libsyntax one step closer to running on stable (see #24518). Closes #24757, erickt's previous attempt at this.
2 parents 6c5834d + 76eaed4 commit a10aec6

File tree

45 files changed

+75
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+75
-63
lines changed

src/libsyntax/ast_map/blocks.rs renamed to src/librustc/ast_map/blocks.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323
2424
pub use self::Code::*;
2525

26-
use abi;
27-
use ast::{Block, FnDecl, NodeId};
28-
use ast;
29-
use ast_map::Node;
30-
use ast_map;
31-
use codemap::Span;
32-
use visit;
26+
use ast_map::{self, Node};
27+
use syntax::abi;
28+
use syntax::ast::{Block, FnDecl, NodeId};
29+
use syntax::ast;
30+
use syntax::codemap::Span;
31+
use syntax::visit;
3332

3433
/// An FnLikeNode is a Node that is like a fn, in that it has a decl
3534
/// and a body (as well as a NodeId, a span, etc).

src/libsyntax/ast_map/mod.rs renamed to src/librustc/ast_map/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ pub use self::Node::*;
1212
pub use self::PathElem::*;
1313
use self::MapEntry::*;
1414

15-
use abi;
16-
use ast::*;
17-
use ast_util;
18-
use codemap::{DUMMY_SP, Span, Spanned};
19-
use fold::Folder;
20-
use parse::token;
21-
use print::pprust;
22-
use visit::{self, Visitor};
15+
use syntax::abi;
16+
use syntax::ast::*;
17+
use syntax::ast_util;
18+
use syntax::codemap::{DUMMY_SP, Span, Spanned};
19+
use syntax::fold::Folder;
20+
use syntax::parse::token;
21+
use syntax::print::pprust;
22+
use syntax::visit::{self, Visitor};
2323

2424
use arena::TypedArena;
2525
use std::cell::RefCell;

src/librustc/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ pub mod back {
9292
pub use rustc_back::x86_64;
9393
}
9494

95+
pub mod ast_map;
96+
9597
pub mod middle {
9698
pub mod astconv_util;
9799
pub mod astencode;

src/librustc/metadata/csearch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// Searching for information from the cstore
1212

13+
use ast_map;
1314
use metadata::common::*;
1415
use metadata::cstore;
1516
use metadata::decoder;
@@ -20,7 +21,6 @@ use rbml;
2021
use rbml::reader;
2122
use std::rc::Rc;
2223
use syntax::ast;
23-
use syntax::ast_map;
2424
use syntax::attr;
2525
use syntax::attr::AttrMetaMethods;
2626
use syntax::diagnostic::expect;

src/librustc/metadata/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
pub use self::DefLike::*;
1616
use self::Family::*;
1717

18+
use ast_map;
1819
use back::svh::Svh;
1920
use metadata::cstore::crate_metadata;
2021
use metadata::common::*;
@@ -44,7 +45,6 @@ use std::str;
4445
use rbml::reader;
4546
use rbml;
4647
use serialize::Decodable;
47-
use syntax::ast_map;
4848
use syntax::attr;
4949
use syntax::parse::token::{IdentInterner, special_idents};
5050
use syntax::parse::token;

src/librustc/metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
pub use self::InlinedItemRef::*;
1717

18+
use ast_map::{self, LinkedPath, PathElem, PathElems};
1819
use back::svh::Svh;
1920
use session::config;
2021
use metadata::common::*;
@@ -34,7 +35,6 @@ use std::io::prelude::*;
3435
use std::io::{Cursor, SeekFrom};
3536
use syntax::abi;
3637
use syntax::ast::{self, DefId, NodeId};
37-
use syntax::ast_map::{self, LinkedPath, PathElem, PathElems};
3838
use syntax::ast_util::*;
3939
use syntax::ast_util;
4040
use syntax::attr;

src/librustc/middle/astencode.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// FIXME: remove this after snapshot, and Results are handled
1313
#![allow(unused_must_use)]
1414

15+
use ast_map;
1516
use metadata::common as c;
1617
use metadata::cstore as cstore;
1718
use session::Session;
@@ -32,7 +33,7 @@ use middle::subst::VecPerParamSpace;
3233
use middle::ty::{self, Ty, MethodCall, MethodCallee, MethodOrigin};
3334
use util::ppaux::ty_to_string;
3435

35-
use syntax::{ast, ast_map, ast_util, codemap, fold};
36+
use syntax::{ast, ast_util, codemap, fold};
3637
use syntax::codemap::Span;
3738
use syntax::fold::Folder;
3839
use syntax::parse::token;

src/librustc/middle/cfg/graphviz.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use std::borrow::IntoCow;
1717
use graphviz as dot;
1818

1919
use syntax::ast;
20-
use syntax::ast_map;
2120

21+
use ast_map;
2222
use middle::cfg;
2323

2424
pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);

src/librustc/middle/check_static_recursion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
// This compiler pass detects static items that refer to themselves
1212
// recursively.
1313

14+
use ast_map;
1415
use session::Session;
1516
use middle::def::{DefStatic, DefConst, DefAssociatedConst, DefMap};
1617

17-
use syntax::ast;
18-
use syntax::{ast_util, ast_map};
18+
use syntax::{ast, ast_util};
1919
use syntax::codemap::Span;
2020
use syntax::visit::Visitor;
2121
use syntax::visit;

src/librustc/middle/const_eval.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pub use self::const_val::*;
1515

1616
use self::ErrKind::*;
1717

18+
use ast_map;
19+
use ast_map::blocks::FnLikeNode;
1820
use metadata::csearch;
1921
use middle::{astencode, def, infer, subst, traits};
2022
use middle::pat_util::def_to_path;
@@ -24,13 +26,12 @@ use util::num::ToPrimitive;
2426
use util::ppaux::Repr;
2527

2628
use syntax::ast::{self, Expr};
27-
use syntax::ast_map::blocks::FnLikeNode;
2829
use syntax::ast_util;
2930
use syntax::codemap::Span;
3031
use syntax::feature_gate;
3132
use syntax::parse::token::InternedString;
3233
use syntax::ptr::P;
33-
use syntax::{ast_map, codemap, visit};
34+
use syntax::{codemap, visit};
3435

3536
use std::borrow::{Cow, IntoCow};
3637
use std::num::wrapping::OverflowingOps;

src/librustc/middle/dead.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
// closely. The idea is that all reachable symbols are live, codes called
1313
// from live codes are live, and everything else is dead.
1414

15+
use ast_map;
1516
use middle::{def, pat_util, privacy, ty};
1617
use lint;
1718
use util::nodemap::NodeSet;
1819

1920
use std::collections::HashSet;
20-
use syntax::{ast, ast_map, codemap};
21+
use syntax::{ast, codemap};
2122
use syntax::ast_util::{local_def, is_local};
2223
use syntax::attr::{self, AttrMetaMethods};
2324
use syntax::visit::{self, Visitor};

src/librustc/middle/entry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
// except according to those terms.
1010

1111

12+
use ast_map;
1213
use session::{config, Session};
1314
use syntax::ast::{Name, NodeId, Item, ItemFn};
14-
use syntax::ast_map;
1515
use syntax::attr;
1616
use syntax::codemap::Span;
1717
use syntax::parse::token;

src/librustc/middle/infer/error_reporting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ use super::region_inference::ProcessedErrors;
7272
use super::region_inference::SameRegions;
7373

7474
use std::collections::HashSet;
75+
use ast_map;
7576
use middle::def;
7677
use middle::infer;
7778
use middle::subst;
@@ -81,7 +82,6 @@ use std::cell::{Cell, RefCell};
8182
use std::char::from_u32;
8283
use std::string::String;
8384
use syntax::ast;
84-
use syntax::ast_map;
8585
use syntax::ast_util::name_to_dummy_lifetime;
8686
use syntax::owned_slice::OwnedSlice;
8787
use syntax::codemap;

src/librustc/middle/intrinsicck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use ast_map::NodeForeignItem;
1112
use metadata::csearch;
1213
use middle::def::DefFn;
1314
use middle::subst::{Subst, Substs, EnumeratedItems};
@@ -18,7 +19,6 @@ use util::ppaux::Repr;
1819
use syntax::abi::RustIntrinsic;
1920
use syntax::ast::DefId;
2021
use syntax::ast;
21-
use syntax::ast_map::NodeForeignItem;
2222
use syntax::codemap::Span;
2323
use syntax::parse::token;
2424
use syntax::visit::Visitor;

src/librustc/middle/mem_categorization.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub use self::categorization::*;
7373

7474
use self::Aliasability::*;
7575

76+
use ast_map;
7677
use middle::check_const;
7778
use middle::def;
7879
use middle::region;
@@ -82,7 +83,6 @@ use util::ppaux::{Repr, UserString};
8283

8384
use syntax::ast::{MutImmutable, MutMutable};
8485
use syntax::ast;
85-
use syntax::ast_map;
8686
use syntax::codemap::Span;
8787
use syntax::print::pprust;
8888
use syntax::parse::token;

src/librustc/middle/reachable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// makes all other generics or inline functions that it references
1616
// reachable as well.
1717

18+
use ast_map;
1819
use middle::def;
1920
use middle::ty;
2021
use middle::privacy;
@@ -24,7 +25,6 @@ use util::nodemap::NodeSet;
2425
use std::collections::HashSet;
2526
use syntax::abi;
2627
use syntax::ast;
27-
use syntax::ast_map;
2828
use syntax::ast_util::is_local;
2929
use syntax::attr;
3030
use syntax::visit::Visitor;

src/librustc/middle/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//! Most of the documentation on regions can be found in
1717
//! `middle/typeck/infer/region_inference.rs`
1818
19+
use ast_map;
1920
use session::Session;
2021
use middle::ty::{self, Ty};
2122
use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
@@ -25,7 +26,6 @@ use syntax::codemap::{self, Span};
2526
use syntax::{ast, visit};
2627
use syntax::ast::{Block, Item, FnDecl, NodeId, Arm, Pat, Stmt, Expr, Local};
2728
use syntax::ast_util::stmt_id;
28-
use syntax::ast_map;
2929
use syntax::ptr::P;
3030
use syntax::visit::{Visitor, FnKind};
3131

src/librustc/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub use self::IntVarValue::*;
3535
pub use self::MethodOrigin::*;
3636
pub use self::CopyImplementationError::*;
3737

38+
use ast_map::{self, LinkedPath};
3839
use back::svh::Svh;
3940
use session::Session;
4041
use lint;
@@ -91,7 +92,6 @@ use syntax::parse::token::{self, InternedString, special_idents};
9192
use syntax::print::pprust;
9293
use syntax::ptr::P;
9394
use syntax::ast;
94-
use syntax::ast_map::{self, LinkedPath};
9595

9696
pub type Disr = u64;
9797

src/librustc/util/ppaux.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111

12+
use ast_map;
1213
use middle::def;
1314
use middle::region;
1415
use middle::subst::{VecPerParamSpace,Subst};
@@ -31,7 +32,6 @@ use std::collections::hash_state::HashState;
3132
use std::hash::Hash;
3233
use std::rc::Rc;
3334
use syntax::abi;
34-
use syntax::ast_map;
3535
use syntax::codemap::{Span, Pos};
3636
use syntax::parse::token;
3737
use syntax::print::pprust;

src/librustc_borrowck/borrowck/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ pub use self::MovedValueUseKind::*;
2020

2121
use self::InteriorKind::*;
2222

23+
use rustc::ast_map;
24+
use rustc::ast_map::blocks::{FnLikeNode, FnParts};
2325
use rustc::middle::cfg;
2426
use rustc::middle::dataflow::DataFlowContext;
2527
use rustc::middle::dataflow::BitwiseOperator;
@@ -35,8 +37,6 @@ use std::mem;
3537
use std::rc::Rc;
3638
use std::string::String;
3739
use syntax::ast;
38-
use syntax::ast_map;
39-
use syntax::ast_map::blocks::{FnLikeNode, FnParts};
4040
use syntax::ast_util;
4141
use syntax::codemap::Span;
4242
use syntax::parse::token;

src/librustc_driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use rustc::session::Session;
1212
use rustc::session::config::{self, Input, OutputFilenames};
1313
use rustc::session::search_paths::PathKind;
14+
use rustc::ast_map;
1415
use rustc::lint;
1516
use rustc::metadata;
1617
use rustc::metadata::creader::CrateReader;
@@ -37,7 +38,6 @@ use std::fs;
3738
use std::io::{self, Write};
3839
use std::path::{Path, PathBuf};
3940
use syntax::ast;
40-
use syntax::ast_map;
4141
use syntax::attr;
4242
use syntax::attr::AttrMetaMethods;
4343
use syntax::diagnostics;

src/librustc_driver/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use rustc_trans::back::link;
1919

2020
use driver;
2121

22+
use rustc::ast_map::{self, blocks, NodePrinter};
2223
use rustc::middle::ty;
2324
use rustc::middle::cfg;
2425
use rustc::middle::cfg::graphviz::LabelledCFG;
@@ -30,7 +31,6 @@ use rustc_borrowck::graphviz as borrowck_dot;
3031
use rustc_resolve as resolve;
3132

3233
use syntax::ast;
33-
use syntax::ast_map::{self, blocks, NodePrinter};
3434
use syntax::codemap;
3535
use syntax::fold::{self, Folder};
3636
use syntax::print::{pp, pprust};

src/librustc_driver/test.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ use rustc_typeck::middle::infer::lub::Lub;
2929
use rustc_typeck::middle::infer::glb::Glb;
3030
use rustc_typeck::middle::infer::sub::Sub;
3131
use rustc_typeck::util::ppaux::{ty_to_string, Repr, UserString};
32+
use rustc::ast_map;
3233
use rustc::session::{self,config};
33-
use syntax::{abi, ast, ast_map};
34+
use syntax::{abi, ast};
3435
use syntax::codemap;
3536
use syntax::codemap::{Span, CodeMap, DUMMY_SP};
3637
use syntax::diagnostic::{Level, RenderSpan, Bug, Fatal, Error, Warning, Note, Help};

src/librustc_lint/builtin.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use middle::ty::{self, Ty};
3535
use middle::{def, pat_util, stability};
3636
use middle::const_eval::{eval_const_expr_partial, const_int, const_uint};
3737
use middle::cfg;
38+
use rustc::ast_map;
3839
use util::ppaux::ty_to_string;
3940
use util::nodemap::{FnvHashMap, NodeSet};
4041
use lint::{Level, Context, LintPass, LintArray, Lint};
@@ -44,7 +45,7 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
4445
use std::{cmp, slice};
4546
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
4647

47-
use syntax::{abi, ast, ast_map};
48+
use syntax::{abi, ast};
4849
use syntax::ast_util::{self, is_shift_binop, local_def};
4950
use syntax::attr::{self, AttrMetaMethods};
5051
use syntax::codemap::{self, Span};

src/librustc_privacy/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use self::FieldName::*;
3333

3434
use std::mem::replace;
3535

36+
use rustc::ast_map;
3637
use rustc::metadata::csearch;
3738
use rustc::middle::def;
3839
use rustc::middle::privacy::ImportUse::*;
@@ -46,7 +47,7 @@ use rustc::middle::ty::MethodTraitObject;
4647
use rustc::middle::ty::{self, Ty};
4748
use rustc::util::nodemap::{NodeMap, NodeSet};
4849

49-
use syntax::{ast, ast_map};
50+
use syntax::ast;
5051
use syntax::ast_util::{is_local, local_def};
5152
use syntax::codemap::Span;
5253
use syntax::parse::token;

0 commit comments

Comments
 (0)