From 36faafee8d836983754005df4e6b7709829aa5ab Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Sat, 25 Nov 2017 06:00:26 -0800 Subject: Use suggestions instead of notes ref mismatches On type mismatch errors, use a suggestion when encountering minimal differences in type differences due to refs, instead of a note. --- src/test/ui/span/coerce-suggestions.rs | 2 +- src/test/ui/span/coerce-suggestions.stderr | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/test/ui/span') diff --git a/src/test/ui/span/coerce-suggestions.rs b/src/test/ui/span/coerce-suggestions.rs index a1a250b0e9a..0a3e18043fe 100644 --- a/src/test/ui/span/coerce-suggestions.rs +++ b/src/test/ui/span/coerce-suggestions.rs @@ -23,7 +23,7 @@ fn main() { //~^ ERROR E0308 //~| NOTE expected &str, found struct `std::string::String` //~| NOTE expected type `&str` - //~| HELP try with `&String::new()` + //~| HELP consider borrowing here let y = String::new(); test(&y); //~^ ERROR E0308 diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index 98ea34fd992..604b38bef6c 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -14,11 +14,13 @@ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:22:19 | 22 | let x: &str = String::new(); - | ^^^^^^^^^^^^^ expected &str, found struct `std::string::String` + | ^^^^^^^^^^^^^ + | | + | expected &str, found struct `std::string::String` + | help: consider borrowing here: `&String::new()` | = note: expected type `&str` found type `std::string::String` - = help: try with `&String::new()` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:28:10 @@ -48,11 +50,13 @@ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:42:9 | 42 | s = format!("foo"); - | ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String` + | ^^^^^^^^^^^^^^ + | | + | expected mutable reference, found struct `std::string::String` + | help: consider mutably borrowing here: `&mut format!("foo")` | = note: expected type `&mut std::string::String` found type `std::string::String` - = help: try with `&mut format!("foo")` = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 6 previous errors -- cgit 1.4.1-3-g733a5