Use more accurate span for :
to ::
suggestion
This commit is contained in:
parent
dd40e0b4ee
commit
b5f94c61f7
9 changed files with 12 additions and 8 deletions
|
@ -1562,9 +1562,11 @@ pub(crate) struct ExpectedFnPathFoundFnKeyword {
|
|||
#[diag(parse_path_single_colon)]
|
||||
pub(crate) struct PathSingleColon {
|
||||
#[primary_span]
|
||||
#[suggestion(applicability = "machine-applicable", code = "::", style = "verbose")]
|
||||
pub span: Span,
|
||||
|
||||
#[suggestion(applicability = "machine-applicable", code = ":", style = "verbose")]
|
||||
pub suggestion: Span,
|
||||
|
||||
#[note(parse_type_ascription_removed)]
|
||||
pub type_ascription: Option<()>,
|
||||
}
|
||||
|
|
|
@ -258,6 +258,7 @@ impl<'a> Parser<'a> {
|
|||
self.bump(); // bump past the colon
|
||||
self.dcx().emit_err(PathSingleColon {
|
||||
span: self.prev_token.span,
|
||||
suggestion: self.prev_token.span.shrink_to_hi(),
|
||||
type_ascription: self
|
||||
.psess
|
||||
.unstable_features
|
||||
|
@ -329,6 +330,7 @@ impl<'a> Parser<'a> {
|
|||
err.cancel();
|
||||
err = self.dcx().create_err(PathSingleColon {
|
||||
span: self.token.span,
|
||||
suggestion: self.prev_token.span.shrink_to_hi(),
|
||||
type_ascription: self
|
||||
.psess
|
||||
.unstable_features
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue