-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Description
fn main() { //~ NOTE expected `()` because of default return type
let s = "abc";
let u: &str = if true { s[..2] } else { s };
}
has an incorrect label:
error[E0308]: mismatched types
--> src/main.rs:3:27
|
1 | fn main() { //~ NOTE expected `()` because of default return type
| - expected `()` because of default return type
2 | let s = "abc";
3 | let u: &str = if true { s[..2] } else { s };
| ^^^^^^ expected &str, found str
|
= note: expected type `&str`
found type `str`
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics