Use more accurate span for :
to ::
suggestion
This commit is contained in:
parent
dd40e0b4ee
commit
b5f94c61f7
@ -1562,9 +1562,11 @@ pub(crate) struct ExpectedFnPathFoundFnKeyword {
|
|||||||
#[diag(parse_path_single_colon)]
|
#[diag(parse_path_single_colon)]
|
||||||
pub(crate) struct PathSingleColon {
|
pub(crate) struct PathSingleColon {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
#[suggestion(applicability = "machine-applicable", code = "::", style = "verbose")]
|
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
|
||||||
|
#[suggestion(applicability = "machine-applicable", code = ":", style = "verbose")]
|
||||||
|
pub suggestion: Span,
|
||||||
|
|
||||||
#[note(parse_type_ascription_removed)]
|
#[note(parse_type_ascription_removed)]
|
||||||
pub type_ascription: Option<()>,
|
pub type_ascription: Option<()>,
|
||||||
}
|
}
|
||||||
|
@ -258,6 +258,7 @@ pub(super) fn parse_path_segments(
|
|||||||
self.bump(); // bump past the colon
|
self.bump(); // bump past the colon
|
||||||
self.dcx().emit_err(PathSingleColon {
|
self.dcx().emit_err(PathSingleColon {
|
||||||
span: self.prev_token.span,
|
span: self.prev_token.span,
|
||||||
|
suggestion: self.prev_token.span.shrink_to_hi(),
|
||||||
type_ascription: self
|
type_ascription: self
|
||||||
.psess
|
.psess
|
||||||
.unstable_features
|
.unstable_features
|
||||||
@ -329,6 +330,7 @@ pub(super) fn parse_path_segment(
|
|||||||
err.cancel();
|
err.cancel();
|
||||||
err = self.dcx().create_err(PathSingleColon {
|
err = self.dcx().create_err(PathSingleColon {
|
||||||
span: self.token.span,
|
span: self.token.span,
|
||||||
|
suggestion: self.prev_token.span.shrink_to_hi(),
|
||||||
type_ascription: self
|
type_ascription: self
|
||||||
.psess
|
.psess
|
||||||
.unstable_features
|
.unstable_features
|
||||||
|
@ -10,7 +10,7 @@ LL | a: Vec<foo::bar:A>,
|
|||||||
help: use a double colon instead
|
help: use a double colon instead
|
||||||
|
|
|
|
||||||
LL | a: Vec<foo::bar::A>,
|
LL | a: Vec<foo::bar::A>,
|
||||||
| ~~
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ LL | let _ = Box:new("foo".to_string());
|
|||||||
help: use a double colon instead
|
help: use a double colon instead
|
||||||
|
|
|
|
||||||
LL | let _ = Box::new("foo".to_string());
|
LL | let _ = Box::new("foo".to_string());
|
||||||
| ~~
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ LL | std:io::stdin();
|
|||||||
help: use a double colon instead
|
help: use a double colon instead
|
||||||
|
|
|
|
||||||
LL | std::io::stdin();
|
LL | std::io::stdin();
|
||||||
| ~~
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ LL | let _ = Option:Some("");
|
|||||||
help: use a double colon instead
|
help: use a double colon instead
|
||||||
|
|
|
|
||||||
LL | let _ = Option::Some("");
|
LL | let _ = Option::Some("");
|
||||||
| ~~
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ LL | let _ = Option:Some(vec![0, 1]);
|
|||||||
help: use a double colon instead
|
help: use a double colon instead
|
||||||
|
|
|
|
||||||
LL | let _ = Option::Some(vec![0, 1]);
|
LL | let _ = Option::Some(vec![0, 1]);
|
||||||
| ~~
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ LL | println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>());
|
|||||||
help: use a double colon instead
|
help: use a double colon instead
|
||||||
|
|
|
|
||||||
LL | println!("{}", std::mem::size_of::<BTreeMap<u32, u32>>());
|
LL | println!("{}", std::mem::size_of::<BTreeMap<u32, u32>>());
|
||||||
| ~~
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ LL | let _: usize = std::mem:size_of::<u32>();
|
|||||||
help: use a double colon instead
|
help: use a double colon instead
|
||||||
|
|
|
|
||||||
LL | let _: usize = std::mem::size_of::<u32>();
|
LL | let _: usize = std::mem::size_of::<u32>();
|
||||||
| ~~
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user