diff options
| author | bors <bors@rust-lang.org> | 2023-02-01 01:15:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-01 01:15:02 +0000 |
| commit | ad8e1dc2863f63c35ef3ceef3064d0851a1d2582 (patch) | |
| tree | 64d8db18dc8c8e118fd859c74061a34efbcae9d4 /compiler/rustc_parse/src | |
| parent | 5b6ed253c42a69b93e7447fb0874a89ab6bc1cfb (diff) | |
| parent | adc3f8a44b943463577a5f8870da8fd18b749351 (diff) | |
| download | rust-ad8e1dc2863f63c35ef3ceef3064d0851a1d2582.tar.gz rust-ad8e1dc2863f63c35ef3ceef3064d0851a1d2582.zip | |
Auto merge of #107536 - GuillaumeGomez:rollup-xv7dx2h, r=GuillaumeGomez
Rollup of 12 pull requests Successful merges: - #106898 (Include both md and yaml ICE ticket templates) - #107331 (Clean up eslint annotations and remove unused JS function) - #107348 (small refactor to new projection code) - #107354 (rustdoc: update Source Serif 4 from 4.004 to 4.005) - #107412 (avoid needless checks) - #107467 (Improve enum checks) - #107486 (Track bound types like bound regions) - #107491 (rustdoc: remove unused CSS from `.setting-check`) - #107508 (`Edition` micro refactor) - #107525 (PointeeInfo is advisory only) - #107527 (rustdoc: stop making unstable items transparent) - #107535 (Replace unwrap with ? in TcpListener doc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 22 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 22 |
2 files changed, 22 insertions, 22 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 4ff9927aab5..58c7a398f14 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -93,11 +93,12 @@ impl<'a> Parser<'a> { // or `auto trait` items. We aim to parse an arbitrary path `a::b` but not something // that starts like a path (1 token), but it fact not a path. // Also, we avoid stealing syntax from `parse_item_`. - if force_collect == ForceCollect::Yes { - self.collect_tokens_no_attrs(|this| this.parse_stmt_path_start(lo, attrs)) - } else { - self.parse_stmt_path_start(lo, attrs) - }? + match force_collect { + ForceCollect::Yes => { + self.collect_tokens_no_attrs(|this| this.parse_stmt_path_start(lo, attrs))? + } + ForceCollect::No => self.parse_stmt_path_start(lo, attrs)?, + } } else if let Some(item) = self.parse_item_common( attrs.clone(), false, @@ -113,13 +114,12 @@ impl<'a> Parser<'a> { self.mk_stmt(lo, StmtKind::Empty) } else if self.token != token::CloseDelim(Delimiter::Brace) { // Remainder are line-expr stmts. - let e = if force_collect == ForceCollect::Yes { - self.collect_tokens_no_attrs(|this| { + let e = match force_collect { + ForceCollect::Yes => self.collect_tokens_no_attrs(|this| { this.parse_expr_res(Restrictions::STMT_EXPR, Some(attrs)) - }) - } else { - self.parse_expr_res(Restrictions::STMT_EXPR, Some(attrs)) - }?; + })?, + ForceCollect::No => self.parse_expr_res(Restrictions::STMT_EXPR, Some(attrs))?, + }; if matches!(e.kind, ExprKind::Assign(..)) && self.eat_keyword(kw::Else) { let bl = self.parse_block()?; // Destructuring assignment ... else. diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 82d9138c7a3..8b4f0ab8feb 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -323,13 +323,14 @@ impl<'a> Parser<'a> { } else if self.can_begin_bound() { self.parse_bare_trait_object(lo, allow_plus)? } else if self.eat(&token::DotDotDot) { - if allow_c_variadic == AllowCVariadic::Yes { - TyKind::CVarArgs - } else { - // FIXME(Centril): Should we just allow `...` syntactically - // anywhere in a type and use semantic restrictions instead? - self.error_illegal_c_varadic_ty(lo); - TyKind::Err + match allow_c_variadic { + AllowCVariadic::Yes => TyKind::CVarArgs, + AllowCVariadic::No => { + // FIXME(Centril): Should we just allow `...` syntactically + // anywhere in a type and use semantic restrictions instead? + self.error_illegal_c_varadic_ty(lo); + TyKind::Err + } } } else { let msg = format!("expected type, found {}", super::token_descr(&self.token)); @@ -343,10 +344,9 @@ impl<'a> Parser<'a> { let mut ty = self.mk_ty(span, kind); // Try to recover from use of `+` with incorrect priority. - if allow_plus == AllowPlus::Yes { - self.maybe_recover_from_bad_type_plus(&ty)?; - } else { - self.maybe_report_ambiguous_plus(impl_dyn_multi, &ty); + match allow_plus { + AllowPlus::Yes => self.maybe_recover_from_bad_type_plus(&ty)?, + AllowPlus::No => self.maybe_report_ambiguous_plus(impl_dyn_multi, &ty), } if RecoverQuestionMark::Yes == recover_question_mark { ty = self.maybe_recover_from_question_mark(ty); |
