Use span_label as it looks better when we show pattern missing binding in order

This commit is contained in:
Esteban Küber 2024-12-15 22:58:16 +00:00
parent 8c8e8d35bc
commit 733fd03f0f
3 changed files with 10 additions and 39 deletions

View file

@ -1,6 +1,6 @@
struct Website {
url: String,
title: Option<String> ,//~ NOTE defined here
title: Option<String>,
}
fn main() {
@ -14,8 +14,7 @@ fn main() {
println!("[{}]({})", title, url); // we hide the errors for `title` and `url`
}
if let Website { url, .. } = website { //~ NOTE `Website` has a field `title`
//~^ NOTE this pattern
if let Website { url, .. } = website { //~ NOTE this pattern
println!("[{}]({})", title, url); //~ ERROR cannot find value `title` in this scope
//~^ NOTE not found in this scope
}