diff options
| author | bors <bors@rust-lang.org> | 2016-08-27 03:07:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-27 03:07:48 -0700 |
| commit | 099b9fdb1a170b57ffd7174b3c3042cc86b7fe91 (patch) | |
| tree | aa3b27019254450634a4fea8583e7cc70d7b7190 /src/libsyntax | |
| parent | 6b74503aa4f2fb4035d9adef9391e9b9658c57ad (diff) | |
| parent | 668d63132e23999f5a74fe65c8c0590a4d9ca215 (diff) | |
| download | rust-099b9fdb1a170b57ffd7174b3c3042cc86b7fe91.tar.gz rust-099b9fdb1a170b57ffd7174b3c3042cc86b7fe91.zip | |
Auto merge of #36030 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests - Successful merges: #35124, #35877, #35953, #36002, #36004, #36005, #36014 - Failed merges:
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 27 |
3 files changed, 27 insertions, 18 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 031d9a2d3f4..26599208ec0 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -491,18 +491,7 @@ fn expand_trait_item(ti: ast::TraitItem, fld: &mut MacroExpander) pub fn expand_type(t: P<ast::Ty>, fld: &mut MacroExpander) -> P<ast::Ty> { let t = match t.node.clone() { ast::TyKind::Mac(mac) => { - if fld.cx.ecfg.features.unwrap().type_macros { - expand_mac_invoc(mac, None, Vec::new(), t.span, fld) - } else { - feature_gate::emit_feature_err( - &fld.cx.parse_sess.span_diagnostic, - "type_macros", - t.span, - feature_gate::GateIssue::Language, - "type macros are experimental"); - - DummyResult::raw_ty(t.span) - } + expand_mac_invoc(mac, None, Vec::new(), t.span, fld) } _ => t }; diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index d746f8e2114..dc68e064634 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -213,9 +213,6 @@ declare_features! ( // Allows associated type defaults (active, associated_type_defaults, "1.2.0", Some(29661)), - // Allows macros to appear in the type position. - (active, type_macros, "1.3.0", Some(27245)), - // allow `repr(simd)`, and importing the various simd intrinsics (active, repr_simd, "1.4.0", Some(27731)), @@ -321,6 +318,8 @@ declare_features! ( // mean anything (accepted, test_accepted_feature, "1.0.0", None), (accepted, tuple_indexing, "1.0.0", None), + // Allows macros to appear in the type position. + (accepted, type_macros, "1.13.0", Some(27245)), (accepted, while_let, "1.0.0", None), // Allows `#[deprecated]` attribute (accepted, deprecated, "1.9.0", Some(29935)) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 9443df6321b..1646246069e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4087,9 +4087,30 @@ impl<'a> Parser<'a> { if !self.eat(&token::OpenDelim(token::Brace)) { let sp = self.span; let tok = self.this_token_to_string(); - return Err(self.span_fatal_help(sp, - &format!("expected `{{`, found `{}`", tok), - "place this code inside a block")); + let mut e = self.span_fatal(sp, &format!("expected `{{`, found `{}`", tok)); + + // Check to see if the user has written something like + // + // if (cond) + // bar; + // + // Which is valid in other languages, but not Rust. + match self.parse_stmt_without_recovery(false) { + Ok(Some(stmt)) => { + let mut stmt_span = stmt.span; + // expand the span to include the semicolon, if it exists + if self.eat(&token::Semi) { + stmt_span.hi = self.last_span.hi; + } + e.span_help(stmt_span, "try placing this code inside a block"); + } + Err(mut e) => { + self.recover_stmt_(SemiColonMode::Break); + e.cancel(); + } + _ => () + } + return Err(e); } self.parse_block_tail(lo, BlockCheckMode::Default) |
