@@ -2,18 +2,18 @@ use std::borrow::Cow;
2
2
use std:: panic:: { catch_unwind, AssertUnwindSafe } ;
3
3
use std:: path:: { Path , PathBuf } ;
4
4
5
+ use rustc_parse:: { new_sub_parser_from_file, parser:: Parser as RawParser } ;
5
6
use rustc_span:: { DUMMY_SP , Span , symbol:: kw} ;
6
7
use syntax:: ast;
7
8
use syntax:: errors:: Diagnostic ;
8
- use syntax:: parse:: parser:: Parser as RawParser ;
9
9
use syntax:: parse:: token:: { DelimToken , TokenKind } ;
10
- use syntax:: parse:: { new_sub_parser_from_file , PResult } ;
10
+ use syntax:: parse:: PResult ;
11
11
12
12
use crate :: syntux:: session:: ParseSess ;
13
13
use crate :: { Config , Input } ;
14
14
15
- pub ( crate ) type DirectoryOwnership = syntax :: parse :: DirectoryOwnership ;
16
- pub ( crate ) type ModulePathSuccess = syntax :: parse :: parser:: ModulePathSuccess ;
15
+ pub ( crate ) type DirectoryOwnership = rustc_parse :: DirectoryOwnership ;
16
+ pub ( crate ) type ModulePathSuccess = rustc_parse :: parser:: ModulePathSuccess ;
17
17
18
18
#[ derive( Clone ) ]
19
19
pub ( crate ) struct Directory {
@@ -22,8 +22,8 @@ pub(crate) struct Directory {
22
22
}
23
23
24
24
impl < ' a > Directory {
25
- fn to_syntax_directory ( & ' a self ) -> syntax :: parse :: Directory < ' a > {
26
- syntax :: parse :: Directory {
25
+ fn to_syntax_directory ( & ' a self ) -> rustc_parse :: Directory < ' a > {
26
+ rustc_parse :: Directory {
27
27
path : Cow :: Borrowed ( & self . path ) ,
28
28
ownership : self . ownership ,
29
29
}
@@ -89,23 +89,23 @@ impl<'a> ParserBuilder<'a> {
89
89
}
90
90
91
91
fn parser (
92
- sess : & ' a syntax:: parse :: ParseSess ,
92
+ sess : & ' a syntax:: sess :: ParseSess ,
93
93
input : Input ,
94
94
directory_ownership : Option < DirectoryOwnership > ,
95
- ) -> Result < syntax :: parse :: parser:: Parser < ' a > , Vec < Diagnostic > > {
95
+ ) -> Result < rustc_parse :: parser:: Parser < ' a > , Vec < Diagnostic > > {
96
96
match input {
97
97
Input :: File ( ref file) => Ok ( if let Some ( directory_ownership) = directory_ownership {
98
- syntax :: parse :: new_sub_parser_from_file (
98
+ rustc_parse :: new_sub_parser_from_file (
99
99
sess,
100
100
file,
101
101
directory_ownership,
102
102
None ,
103
103
DUMMY_SP ,
104
104
)
105
105
} else {
106
- syntax :: parse :: new_parser_from_file ( sess, file)
106
+ rustc_parse :: new_parser_from_file ( sess, file)
107
107
} ) ,
108
- Input :: Text ( text) => syntax :: parse :: maybe_new_parser_from_source_str (
108
+ Input :: Text ( text) => rustc_parse :: maybe_new_parser_from_source_str (
109
109
sess,
110
110
rustc_span:: FileName :: Custom ( "stdin" . to_owned ( ) ) ,
111
111
text,
@@ -130,7 +130,7 @@ pub(crate) enum ParserError {
130
130
131
131
impl < ' a > Parser < ' a > {
132
132
pub ( crate ) fn submod_path_from_attr ( attrs : & [ ast:: Attribute ] , path : & Path ) -> Option < PathBuf > {
133
- syntax :: parse :: parser:: Parser :: submod_path_from_attr ( attrs, path)
133
+ rustc_parse :: parser:: Parser :: submod_path_from_attr ( attrs, path)
134
134
}
135
135
136
136
// FIXME(topecongiro) Use the method from libsyntax[1] once it become public.
@@ -280,7 +280,7 @@ impl<'a> Parser<'a> {
280
280
mac : & ' a ast:: Mac ,
281
281
base_dir : & Directory ,
282
282
) -> Result < Vec < ast:: Item > , & ' static str > {
283
- let mut parser = syntax :: parse :: stream_to_parser_with_base_dir (
283
+ let mut parser = rustc_parse :: stream_to_parser_with_base_dir (
284
284
sess. inner ( ) ,
285
285
mac. tts . clone ( ) ,
286
286
base_dir. to_syntax_directory ( ) ,
0 commit comments