diff options
| author | bors <bors@rust-lang.org> | 2018-05-24 12:05:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-05-24 12:05:47 +0000 |
| commit | d022dd48cceaceffa931f87490c7921aa3c3f8b1 (patch) | |
| tree | 013703f4727458d33748f5aca0fa05aacec34bc8 /src/libsyntax/parse/parser.rs | |
| parent | a76bff86e6f4b56b2c3fd1704ce8535ed207dd78 (diff) | |
| parent | 98606cfe126b1ac7b68e25814c3e20c6b0b3b17c (diff) | |
| download | rust-d022dd48cceaceffa931f87490c7921aa3c3f8b1.tar.gz rust-d022dd48cceaceffa931f87490c7921aa3c3f8b1.zip | |
Auto merge of #51023 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests Successful merges: - #50864 (Add NetBSD/arm target specs) - #50956 (rust-gdb: work around the re-used -d argument in cgdb) - #50964 (Make sure that queries have predictable symbol names.) - #50965 (Update LLVM to pull in another wasm fix) - #50972 (Add -Z no-parallel-llvm flag) - #50979 (Fix span for type-only arguments) - #50981 (Shrink `LiveNode`.) - #50995 (move type out of unsafe block) - #51011 ( rustdoc: hide macro export statements from docs) Failed merges:
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 9b9fcfa74b1..5a3e5586495 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1772,27 +1772,27 @@ impl<'a> Parser<'a> { pub fn parse_arg_general(&mut self, require_name: bool) -> PResult<'a, Arg> { maybe_whole!(self, NtArg, |x| x); - let pat = if require_name || self.is_named_argument() { + let (pat, ty) = if require_name || self.is_named_argument() { debug!("parse_arg_general parse_pat (require_name:{})", require_name); let pat = self.parse_pat()?; self.expect(&token::Colon)?; - pat + (pat, self.parse_ty()?) } else { debug!("parse_arg_general ident_to_pat"); let ident = Ident::new(keywords::Invalid.name(), self.prev_span); - P(Pat { + let ty = self.parse_ty()?; + let pat = P(Pat { id: ast::DUMMY_NODE_ID, node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), ident, None), - span: ident.span, - }) + span: ty.span, + }); + (pat, ty) }; - let t = self.parse_ty()?; - Ok(Arg { - ty: t, + ty, pat, id: ast::DUMMY_NODE_ID, }) |
