Tweak labels
This commit is contained in:
parent
8ba1a97e37
commit
b1a6c32660
@ -3289,8 +3289,7 @@ impl<'a> Resolver<'a> {
|
||||
let line_sp = cm.lookup_char_pos(sp.hi()).line;
|
||||
let line_base_sp = cm.lookup_char_pos(base_span.lo()).line;
|
||||
if snippet == ":" {
|
||||
err.span_label(base_span,
|
||||
"expecting a type here because of type ascription");
|
||||
let mut show_label = true;
|
||||
if line_sp != line_base_sp {
|
||||
err.span_suggestion_short(
|
||||
sp,
|
||||
@ -3312,6 +3311,7 @@ impl<'a> Resolver<'a> {
|
||||
"::".to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
show_label = false;
|
||||
}
|
||||
if let Ok(base_snippet) = base_snippet {
|
||||
err.span_suggestion(
|
||||
@ -3320,8 +3320,13 @@ impl<'a> Resolver<'a> {
|
||||
format!("let {}", base_snippet),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
show_label = false;
|
||||
}
|
||||
}
|
||||
if show_label {
|
||||
err.span_label(base_span,
|
||||
"expecting a type here because of type ascription");
|
||||
}
|
||||
break;
|
||||
} else if !snippet.trim().is_empty() {
|
||||
debug!("tried to find type ascription `:` token, couldn't find it");
|
||||
|
@ -5,7 +5,6 @@ LL | temp: i32 = fun(5i32);
|
||||
| ^^^^
|
||||
| |
|
||||
| not found in this scope
|
||||
| expecting a type here because of type ascription
|
||||
| help: maybe you meant to write an assignment here: `let temp`
|
||||
|
||||
error[E0425]: cannot find value `temp` in this scope
|
||||
|
@ -8,10 +8,7 @@ error[E0423]: expected value, found module `std`
|
||||
--> $DIR/type-ascription-instead-of-path.rs:2:5
|
||||
|
|
||||
LL | std:io::stdin();
|
||||
| ^^^
|
||||
| |
|
||||
| not a value
|
||||
| expecting a type here because of type ascription
|
||||
| ^^^ not a value
|
||||
help: maybe you meant to write a path separator here
|
||||
|
|
||||
LL | std::io::stdin();
|
||||
|
Loading…
x
Reference in New Issue
Block a user