Skip to content

Commit a252474

Browse files
committed
proc_macro: move compiler crate imports to the rustc module.
1 parent dd3be67 commit a252474

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/libproc_macro/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@
4242
#![feature(box_into_raw_non_null)]
4343
#![feature(nonnull_cast)]
4444

45-
extern crate syntax;
46-
extern crate syntax_pos;
47-
extern crate rustc_errors;
48-
extern crate rustc_data_structures;
49-
5045
#[unstable(feature = "proc_macro_internals", issue = "27812")]
5146
#[doc(hidden)]
5247
pub mod bridge;
@@ -66,8 +61,6 @@ use std::{ascii, fmt, iter};
6661
use std::path::PathBuf;
6762
use std::str::FromStr;
6863

69-
use syntax::symbol::Symbol;
70-
7164
/// The main type provided by this crate, representing an abstract stream of
7265
/// tokens.
7366
///
@@ -400,13 +393,13 @@ pub enum Delimiter {
400393
/// An interned string.
401394
#[derive(Copy, Clone, Debug)]
402395
#[unstable(feature = "proc_macro", issue = "38356")]
403-
pub struct Term(Symbol);
396+
pub struct Term(::rustc::Symbol);
404397

405398
impl Term {
406399
/// Intern a string into a `Term`.
407400
#[unstable(feature = "proc_macro", issue = "38356")]
408401
pub fn intern(string: &str) -> Term {
409-
Term(Symbol::intern(string))
402+
Term(::rustc::Symbol::intern(string))
410403
}
411404

412405
/// Get a reference to the interned string.

src/libproc_macro/rustc.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,24 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
extern crate syntax;
12+
extern crate syntax_pos;
13+
extern crate rustc_errors;
14+
extern crate rustc_data_structures;
15+
1116
use {Delimiter, Literal, LiteralKind, Spacing, Term, TokenNode};
1217

13-
use rustc_data_structures::sync::Lrc;
14-
use rustc_errors::{Diagnostic, DiagnosticBuilder, Level};
1518
use std::path::PathBuf;
16-
use syntax_pos::{self, SyntaxContext, FileMap, FileName, MultiSpan, Pos, DUMMY_SP};
17-
use syntax_pos::hygiene::Mark;
18-
use syntax::ast;
19-
use syntax::ext::base::{ExtCtxt, ProcMacro};
20-
use syntax::parse::{self, token, ParseSess};
21-
use syntax::tokenstream;
19+
use self::rustc_data_structures::sync::Lrc;
20+
use self::rustc_errors::{Diagnostic, DiagnosticBuilder, Level};
21+
use self::syntax_pos::{SyntaxContext, FileMap, FileName, MultiSpan, Pos, DUMMY_SP};
22+
use self::syntax_pos::hygiene::Mark;
23+
use self::syntax::ast;
24+
use self::syntax::ext::base::{ExtCtxt, ProcMacro};
25+
use self::syntax::parse::{self, token, ParseSess};
26+
use self::syntax::tokenstream;
27+
28+
pub use self::syntax_pos::symbol::Symbol;
2229

2330
pub struct Quoter;
2431

@@ -169,8 +176,8 @@ impl<'a> ::bridge::FrontendInterface for Rustc<'a> {
169176
}
170177
fn token_stream_from_token_tree(&self, node: ::TokenNode, span: Self::Span)
171178
-> Self::TokenStream {
172-
use syntax::parse::token::*;
173-
use syntax::tokenstream::TokenTree;
179+
use self::syntax::parse::token::*;
180+
use self::syntax::tokenstream::TokenTree;
174181

175182
let (op, kind) = match node {
176183
TokenNode::Op(op, kind) => (op, kind),
@@ -224,7 +231,7 @@ impl<'a> ::bridge::FrontendInterface for Rustc<'a> {
224231
-> (Self::Span,
225232
Result<(::TokenNode, Option<Self::TokenStream>),
226233
(::Delimiter, Self::TokenStream)>) {
227-
use syntax::parse::token::*;
234+
use self::syntax::parse::token::*;
228235

229236
let mut next = None;
230237

0 commit comments

Comments
 (0)