diff options
| author | Stein Somers <git@steinsomers.be> | 2019-02-18 00:31:41 +0100 |
|---|---|---|
| committer | Stein Somers <git@steinsomers.be> | 2019-02-18 00:31:41 +0100 |
| commit | 01bebdf19321a1597f35c2fc2130f1627e944bcf (patch) | |
| tree | 2c71bc6a77545eacabdc67b1fcaa5f52dd22878c /src/libsyntax/util/parser_testing.rs | |
| parent | 0b9ad6e6fd017837647eed8e5ae824d1f6e278b2 (diff) | |
| parent | 9a3392e174a432a5f06c1157befc1ce0fae74bec (diff) | |
| download | rust-01bebdf19321a1597f35c2fc2130f1627e944bcf.tar.gz rust-01bebdf19321a1597f35c2fc2130f1627e944bcf.zip | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/libsyntax/util/parser_testing.rs')
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index d0b3cd865ce..733c4f83e37 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -1,18 +1,22 @@ -use ast::{self, Ident}; -use source_map::FilePathMapping; -use parse::{ParseSess, PResult, source_file_to_stream}; -use parse::{lexer, new_parser_from_source_str}; -use parse::parser::Parser; -use ptr::P; -use tokenstream::TokenStream; +use crate::ast::{self, Ident}; +use crate::source_map::FilePathMapping; +use crate::parse::{ParseSess, PResult, source_file_to_stream}; +use crate::parse::{lexer, new_parser_from_source_str}; +use crate::parse::parser::Parser; +use crate::ptr::P; +use crate::tokenstream::TokenStream; + use std::iter::Peekable; use std::path::PathBuf; /// Map a string to tts, using a made-up filename: pub fn string_to_stream(source_str: String) -> TokenStream { let ps = ParseSess::new(FilePathMapping::empty()); - source_file_to_stream(&ps, ps.source_map() - .new_source_file(PathBuf::from("bogofile").into(), source_str), None) + source_file_to_stream( + &ps, + ps.source_map().new_source_file(PathBuf::from("bogofile").into(), + source_str, + ), None).0 } /// Map string to parser (via tts) @@ -62,7 +66,7 @@ pub fn string_to_pat(source_str: String) -> P<ast::Pat> { }) } -/// Convert a vector of strings to a vector of Ident's +/// Converts a vector of strings to a vector of Ident's pub fn strs_to_idents(ids: Vec<&str> ) -> Vec<Ident> { ids.iter().map(|u| Ident::from_str(*u)).collect() } |
