diff options
| author | bors <bors@rust-lang.org> | 2019-06-15 18:24:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-06-15 18:24:18 +0000 |
| commit | bb16e72954ec5a048dd46ffef23416662765b368 (patch) | |
| tree | 3a2d9840c569f96fa1db0200b4709992cd2a8367 /src/libsyntax | |
| parent | 9f06855064ed06a50c496577b21ca50f92a2e67d (diff) | |
| parent | ab2d2f90c49437fb99f1bc469e13d62c1b2addeb (diff) | |
| download | rust-bb16e72954ec5a048dd46ffef23416662765b368.tar.gz rust-bb16e72954ec5a048dd46ffef23416662765b368.zip | |
Auto merge of #61868 - Centril:rollup-gglsecp, r=Centril
Rollup of 6 pull requests Successful merges: - #61785 (note some safety concerns of raw-ptr-to-ref casts) - #61805 (typeck: Fix ICE for blocks in repeat expr count.) - #61813 (Remove some unnecessary symbol interner ops) - #61824 (in which we decline to lint single-use lifetimes in `derive`d impls) - #61844 (Change `...` to `..=` where applicable) - #61854 (Minor cosmetic improvements to accompany PR 61825) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/diagnostics/plugin.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/test.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/util/parser.rs | 2 |
5 files changed, 16 insertions, 28 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 68cb8c8574d..54cd4035a7b 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1181,7 +1181,7 @@ pub enum ExprKind { Field(P<Expr>, Ident), /// An indexing operation (e.g., `foo[2]`). Index(P<Expr>, P<Expr>), - /// A range (e.g., `1..2`, `1..`, `..2`, `1...2`, `1...`, `...2`). + /// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`). Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits), /// Variable reference, possibly containing `::` and/or type diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 98351048c35..ee640a1603a 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -120,19 +120,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt<'_>, } }); - let span = span.apply_mark(ecx.current_expansion.mark); - - let name = Ident::from_str_and_span(&format!("__register_diagnostic_{}", code), span).gensym(); - - MacEager::items(smallvec![ - ecx.item_mod( - span, - span, - name, - vec![], - vec![], - ) - ]) + MacEager::items(smallvec![]) } #[allow(deprecated)] diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 5dbf21867af..6b699464ba9 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -249,8 +249,9 @@ pub fn compile( def: &ast::Item, edition: Edition ) -> SyntaxExtension { - let lhs_nm = ast::Ident::from_str("lhs").gensym(); - let rhs_nm = ast::Ident::from_str("rhs").gensym(); + let lhs_nm = ast::Ident::new(sym::lhs, def.span); + let rhs_nm = ast::Ident::new(sym::rhs, def.span); + let tt_spec = ast::Ident::new(sym::tt, def.span); // Parse the macro_rules! invocation let body = match def.node { @@ -266,9 +267,9 @@ pub fn compile( let argument_gram = vec![ quoted::TokenTree::Sequence(DelimSpan::dummy(), Lrc::new(quoted::SequenceRepetition { tts: vec![ - quoted::TokenTree::MetaVarDecl(def.span, lhs_nm, ast::Ident::from_str("tt")), + quoted::TokenTree::MetaVarDecl(def.span, lhs_nm, tt_spec), quoted::TokenTree::token(token::FatArrow, def.span), - quoted::TokenTree::MetaVarDecl(def.span, rhs_nm, ast::Ident::from_str("tt")), + quoted::TokenTree::MetaVarDecl(def.span, rhs_nm, tt_spec), ], separator: Some(Token::new( if body.legacy { token::Semi } else { token::Comma }, def.span @@ -1115,10 +1116,9 @@ fn has_legal_fragment_specifier(sess: &ParseSess, tok: "ed::TokenTree) -> Result<(), String> { debug!("has_legal_fragment_specifier({:?})", tok); if let quoted::TokenTree::MetaVarDecl(_, _, ref frag_spec) = *tok { - let frag_name = frag_spec.as_str(); let frag_span = tok.span(); - if !is_legal_fragment_specifier(sess, features, attrs, &frag_name, frag_span) { - return Err(frag_name.to_string()); + if !is_legal_fragment_specifier(sess, features, attrs, frag_spec.name, frag_span) { + return Err(frag_spec.to_string()); } } Ok(()) @@ -1127,7 +1127,7 @@ fn has_legal_fragment_specifier(sess: &ParseSess, fn is_legal_fragment_specifier(_sess: &ParseSess, _features: &Features, _attrs: &[ast::Attribute], - frag_name: &str, + frag_name: Symbol, _frag_span: Span) -> bool { /* * If new fragment specifiers are invented in nightly, `_sess`, @@ -1136,9 +1136,9 @@ fn is_legal_fragment_specifier(_sess: &ParseSess, * this function. */ match frag_name { - "item" | "block" | "stmt" | "expr" | "pat" | "lifetime" | - "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "literal" | - "" => true, + sym::item | sym::block | sym::stmt | sym::expr | sym::pat | + sym::lifetime | sym::path | sym::ty | sym::ident | sym::meta | sym::tt | + sym::vis | sym::literal | kw::Invalid => true, _ => false, } } diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 1998ec19f13..cbaf12529c1 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -327,7 +327,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> { // } let sp = ignored_span(cx, DUMMY_SP); let ecx = &cx.ext_cx; - let test_id = ecx.ident_of("test").gensym(); + let test_id = Ident::with_empty_ctxt(sym::test); // test::test_main_static(...) let mut test_runner = cx.test_runner.clone().unwrap_or( @@ -350,7 +350,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> { let test_extern_stmt = ecx.stmt_item(sp, ecx.item(sp, test_id, vec![], - ast::ItemKind::ExternCrate(Some(sym::test)) + ast::ItemKind::ExternCrate(None) )); // pub fn main() { ... } diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs index 69dd96625cc..fcecee8c57f 100644 --- a/src/libsyntax/util/parser.rs +++ b/src/libsyntax/util/parser.rs @@ -234,7 +234,7 @@ pub const PREC_RESET: i8 = -100; pub const PREC_CLOSURE: i8 = -40; pub const PREC_JUMP: i8 = -30; pub const PREC_RANGE: i8 = -10; -// The range 2 ... 14 is reserved for AssocOp binary operator precedences. +// The range 2..=14 is reserved for AssocOp binary operator precedences. pub const PREC_PREFIX: i8 = 50; pub const PREC_POSTFIX: i8 = 60; pub const PREC_PAREN: i8 = 99; |
