diff options
| author | Gianni Ciccarelli <gianni.ciccarelli@gmail.com> | 2017-04-26 03:17:48 +0000 |
|---|---|---|
| committer | Gianni Ciccarelli <gianni.ciccarelli@gmail.com> | 2017-04-26 14:43:09 +0000 |
| commit | b48eb5e0be2a6e06d9629f770288c46f7bcb326c (patch) | |
| tree | 788c9f27af9f780a3765dbdd80e9981274698265 /src/libsyntax/parse | |
| parent | 715811d0be05dcdc55b44f97d9fd2cd1eb7eee05 (diff) | |
| download | rust-b48eb5e0be2a6e06d9629f770288c46f7bcb326c.tar.gz rust-b48eb5e0be2a6e06d9629f770288c46f7bcb326c.zip | |
support `default impl` for specialization
`[default] [unsafe] impl` and typecheck
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 2c10fff03db..f806e1e3bde 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4918,12 +4918,9 @@ impl<'a> Parser<'a> { allowed to have generics"); } - match defaultness { - ast::Defaultness::Default => { - self.span_err(impl_span, "`default impl` is not allowed for \ - default trait implementations"); - } - _ => {} + if let ast::Defaultness::Default = defaultness { + self.span_err(impl_span, "`default impl` is not allowed for \ + default trait implementations"); } self.expect(&token::OpenDelim(token::Brace))?; @@ -5768,13 +5765,13 @@ impl<'a> Parser<'a> { } if (self.check_keyword(keywords::Unsafe) && self.look_ahead(1, |t| t.is_keyword(keywords::Impl))) || - (self.check_keyword(keywords::Unsafe) && - self.look_ahead(1, |t| t.is_keyword(keywords::Default)) && + (self.check_keyword(keywords::Default) && + self.look_ahead(1, |t| t.is_keyword(keywords::Unsafe)) && self.look_ahead(2, |t| t.is_keyword(keywords::Impl))) { // IMPL ITEM - self.expect_keyword(keywords::Unsafe)?; let defaultness = self.parse_defaultness()?; + self.expect_keyword(keywords::Unsafe)?; self.expect_keyword(keywords::Impl)?; let (ident, item_, |
