diff options
| author | bors <bors@rust-lang.org> | 2015-04-26 09:52:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-26 09:52:28 +0000 |
| commit | 6365080c5cd27b74ec87420c351a3e7bdcff988e (patch) | |
| tree | 4cace13a2f04314b229a2c1860b7f672deb96ec4 /src/libsyntax/parse/parser.rs | |
| parent | b0043db4658feed7b7d17fd45285745d8af38001 (diff) | |
| parent | 24ef90527351bb1a52c8b54e948cdbba8db3eef6 (diff) | |
| download | rust-6365080c5cd27b74ec87420c351a3e7bdcff988e.tar.gz rust-6365080c5cd27b74ec87420c351a3e7bdcff988e.zip | |
Auto merge of #23085 - goffrie:interpolating-quote, r=huonw
This changes the `ToTokens` implementations for expressions, statements, etc. with almost-trivial ones that produce `Interpolated(*Nt(...))` pseudo-tokens. In this way, quasiquote now works the same way as macros do: already-parsed AST fragments are used as-is, not reparsed. The `ToSource` trait is removed. Quasiquote no longer involves pretty-printing at all, which removes the need for the `encode_with_hygiene` hack. All associated machinery is removed. New `Nonterminal`s are added: NtArm, NtImplItem, and NtTraitItem. These are just for quasiquote, not macros. `ToTokens` is no longer implemented for `Arg` (although this could be added again) and `Generics` (which I don't think makes sense). This breaks any compiler extensions that relied on the ability of `ToTokens` to turn AST fragments back into inspectable token trees. For this reason, this closes #16987. As such, this is a [breaking-change]. Fixes #16472. Fixes #15962. Fixes #17397. Fixes #16617.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 47ea8d556fa..5f097256318 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1152,7 +1152,8 @@ impl<'a> Parser<'a> { &token::OpenDelim(token::Brace), &token::CloseDelim(token::Brace), seq_sep_none(), - |p| { + |p| -> PResult<P<TraitItem>> { + maybe_whole!(no_clone p, NtTraitItem); let mut attrs = p.parse_outer_attributes(); let lo = p.span.lo; @@ -2943,6 +2944,8 @@ impl<'a> Parser<'a> { } pub fn parse_arm_nopanic(&mut self) -> PResult<Arm> { + maybe_whole!(no_clone self, NtArm); + let attrs = self.parse_outer_attributes(); let pats = try!(self.parse_pats()); let mut guard = None; @@ -4335,6 +4338,8 @@ impl<'a> Parser<'a> { /// Parse an impl item. pub fn parse_impl_item(&mut self) -> PResult<P<ImplItem>> { + maybe_whole!(no_clone self, NtImplItem); + let mut attrs = self.parse_outer_attributes(); let lo = self.span.lo; let vis = try!(self.parse_visibility()); |
