diff options
| author | bors <bors@rust-lang.org> | 2016-08-16 00:12:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-16 00:12:12 -0700 |
| commit | e25542cb02d946959517ebb68e2f7b1318817237 (patch) | |
| tree | 64775f55741e98f44e5e2ee854e6707e2f4b4da9 /src/libsyntax/parse | |
| parent | 197be89f367d1240d5f9cd9c4efd77812775354e (diff) | |
| parent | f59f1f0914de50ffa70e3000c317a14f6d1b8605 (diff) | |
| download | rust-e25542cb02d946959517ebb68e2f7b1318817237.tar.gz rust-e25542cb02d946959517ebb68e2f7b1318817237.zip | |
Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis
Implement the `!` type This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index e174f3ad08d..126e8816d05 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1332,11 +1332,7 @@ impl<'a> Parser<'a> { /// Parse optional return type [ -> TY ] in function decl pub fn parse_ret_ty(&mut self) -> PResult<'a, FunctionRetTy> { if self.eat(&token::RArrow) { - if self.eat(&token::Not) { - Ok(FunctionRetTy::None(self.last_span)) - } else { - Ok(FunctionRetTy::Ty(self.parse_ty()?)) - } + Ok(FunctionRetTy::Ty(self.parse_ty()?)) } else { let pos = self.span.lo; Ok(FunctionRetTy::Default(mk_sp(pos, pos))) @@ -1399,6 +1395,8 @@ impl<'a> Parser<'a> { } else { TyKind::Tup(ts) } + } else if self.eat(&token::Not) { + TyKind::Never } else if self.check(&token::BinOp(token::Star)) { // STAR POINTER (bare pointer?) self.bump(); |
