diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /compiler/rustc_parse/src/parser/ty.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_parse/src/parser/ty.rs')
-rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index a25b0f1f8..be2cbaf30 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -18,9 +18,8 @@ use rustc_ast::{ TraitObjectSyntax, Ty, TyKind, }; use rustc_errors::{Applicability, PResult}; -use rustc_span::source_map::Span; use rustc_span::symbol::{kw, sym, Ident}; -use rustc_span::Symbol; +use rustc_span::{Span, Symbol}; use thin_vec::{thin_vec, ThinVec}; /// Any `?`, `!`, or `~const` modifiers that appear at the start of a bound. @@ -247,7 +246,7 @@ impl<'a> Parser<'a> { )?; FnRetTy::Ty(ty) } else { - FnRetTy::Default(self.token.span.shrink_to_lo()) + FnRetTy::Default(self.prev_token.span.shrink_to_hi()) }) } @@ -893,13 +892,15 @@ impl<'a> Parser<'a> { // to recover from errors, not make more). let path = if self.may_recover() { let (span, message, sugg, path, applicability) = match &ty.kind { - TyKind::Ptr(..) | TyKind::Ref(..) if let TyKind::Path(_, path) = &ty.peel_refs().kind => { + TyKind::Ptr(..) | TyKind::Ref(..) + if let TyKind::Path(_, path) = &ty.peel_refs().kind => + { ( ty.span.until(path.span), "consider removing the indirection", "", path, - Applicability::MaybeIncorrect + Applicability::MaybeIncorrect, ) } TyKind::ImplTrait(_, bounds) @@ -910,10 +911,10 @@ impl<'a> Parser<'a> { "use the trait bounds directly", "", &tr.trait_ref.path, - Applicability::MachineApplicable + Applicability::MachineApplicable, ) } - _ => return Err(err) + _ => return Err(err), }; err.span_suggestion_verbose(span, message, sugg, applicability); @@ -1027,7 +1028,8 @@ impl<'a> Parser<'a> { args.into_iter() .filter_map(|arg| { if let ast::AngleBracketedArg::Arg(generic_arg) = arg - && let ast::GenericArg::Lifetime(lifetime) = generic_arg { + && let ast::GenericArg::Lifetime(lifetime) = generic_arg + { Some(lifetime) } else { None |