diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-05-19 15:59:52 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-05-19 16:53:06 +1000 |
| commit | 7a37e0c2ff8b8fb0346e519418e1e7cb2a33bc45 (patch) | |
| tree | f2ed640d63ad36e4647814d1bedaddf45ae7d9c8 /compiler/rustc_parse/src/parser/ty.rs | |
| parent | a148a32fdc3f3767487d54147edbbe2c225c4fbf (diff) | |
| download | rust-7a37e0c2ff8b8fb0346e519418e1e7cb2a33bc45.tar.gz rust-7a37e0c2ff8b8fb0346e519418e1e7cb2a33bc45.zip | |
Move condition out of `maybe_report_ambiguous_plus` and `maybe_recover_from_bad_type_plus`.
Diffstat (limited to 'compiler/rustc_parse/src/parser/ty.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 6c8eb8b39d1..708940c8aa8 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -315,8 +315,11 @@ impl<'a> Parser<'a> { let mut ty = self.mk_ty(span, kind); // Try to recover from use of `+` with incorrect priority. - self.maybe_report_ambiguous_plus(allow_plus, impl_dyn_multi, &ty); - self.maybe_recover_from_bad_type_plus(allow_plus, &ty)?; + if matches!(allow_plus, AllowPlus::Yes) { + self.maybe_recover_from_bad_type_plus(&ty)?; + } else { + self.maybe_report_ambiguous_plus(impl_dyn_multi, &ty); + } if let RecoverQuestionMark::Yes = recover_question_mark { ty = self.maybe_recover_from_question_mark(ty); } |
