diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2016-04-19 00:42:18 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2016-04-24 20:59:44 +0300 |
| commit | 6c44bea64435fd3859439a6ecab7758855a13f07 (patch) | |
| tree | 8035ecf05376fd4cb0723d1dbce3da49e28fcc49 /src/libsyntax/ext | |
| parent | b32d7b592306a2784585e842193db1546a2f9587 (diff) | |
| download | rust-6c44bea64435fd3859439a6ecab7758855a13f07.tar.gz rust-6c44bea64435fd3859439a6ecab7758855a13f07.zip | |
syntax: Check paths in visibilities for type parameters
syntax: Merge PathParsingMode::NoTypesAllowed and PathParsingMode::ImportPrefix syntax: Rename PathParsingMode and its variants to better express their purpose syntax: Remove obsolete error message about 'self lifetime syntax: Remove ALLOW_MODULE_PATHS workaround syntax/resolve: Adjust some error messages resolve: Compare unhygienic (not renamed) names with keywords::Invalid, invalid identifiers may appear to be valid after renaming
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 11 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index dd6e9a1e4a6..001db0b13ca 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1486,7 +1486,7 @@ mod tests { use ext::mtwt; use fold::Folder; use parse; - use parse::token; + use parse::token::{self, keywords}; use util::parser_testing::{string_to_parser}; use util::parser_testing::{string_to_pat, string_to_crate, strs_to_idents}; use visit; diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 9734b49ba7c..ee9a197ce56 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -13,7 +13,7 @@ use codemap::Span; use ext::base::ExtCtxt; use ext::base; use ext::build::AstBuilder; -use parse::parser::{Parser, PathParsingMode}; +use parse::parser::{Parser, PathStyle}; use parse::token::*; use parse::token; use ptr::P; @@ -401,7 +401,7 @@ pub fn parse_meta_item_panic(parser: &mut Parser) -> P<ast::MetaItem> { panictry!(parser.parse_meta_item()) } -pub fn parse_path_panic(parser: &mut Parser, mode: PathParsingMode) -> ast::Path { +pub fn parse_path_panic(parser: &mut Parser, mode: PathStyle) -> ast::Path { panictry!(parser.parse_path(mode)) } @@ -500,7 +500,7 @@ pub fn expand_quote_path(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<base::MacResult+'static> { - let mode = mk_parser_path(cx, sp, "LifetimeAndTypesWithoutColons"); + let mode = mk_parser_path(cx, sp, &["PathStyle", "Type"]); let expanded = expand_parse_call(cx, sp, "parse_path_panic", vec!(mode), tts); base::MacEager::expr(expanded) } @@ -557,8 +557,9 @@ fn mk_token_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> { cx.expr_path(cx.path_global(sp, idents)) } -fn mk_parser_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> { - let idents = vec!(id_ext("syntax"), id_ext("parse"), id_ext("parser"), id_ext(name)); +fn mk_parser_path(cx: &ExtCtxt, sp: Span, names: &[&str]) -> P<ast::Expr> { + let mut idents = vec![id_ext("syntax"), id_ext("parse"), id_ext("parser")]; + idents.extend(names.iter().cloned().map(id_ext)); cx.expr_path(cx.path_global(sp, idents)) } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 8b33bbd3700..89ecf02ee4c 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -85,7 +85,7 @@ use codemap; use errors::FatalError; use parse::lexer::*; //resolve bug? use parse::ParseSess; -use parse::parser::{LifetimeAndTypesWithoutColons, Parser}; +use parse::parser::{PathStyle, Parser}; use parse::token::{DocComment, MatchNt, SubstNt}; use parse::token::{Token, Nonterminal}; use parse::token; @@ -546,7 +546,7 @@ pub fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal { } }, "path" => { - token::NtPath(Box::new(panictry!(p.parse_path(LifetimeAndTypesWithoutColons)))) + token::NtPath(Box::new(panictry!(p.parse_path(PathStyle::Type)))) }, "meta" => token::NtMeta(panictry!(p.parse_meta_item())), _ => { |
