diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2017-01-11 13:55:41 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2017-01-17 14:28:53 -0800 |
| commit | fc774e629fd805ef46566894da482ed8be680303 (patch) | |
| tree | 04e098b9d07adac374ea2cfe041c64df788d1430 /src/test | |
| parent | bd8e9b0c828bce489eb948853a6cf86b69b26799 (diff) | |
| download | rust-fc774e629fd805ef46566894da482ed8be680303.tar.gz rust-fc774e629fd805ef46566894da482ed8be680303.zip | |
Teach Diagnostics to highlight text
Diffstat (limited to 'src/test')
22 files changed, 102 insertions, 19 deletions
diff --git a/src/test/compile-fail-fulldeps/proc-macro/signature.rs b/src/test/compile-fail-fulldeps/proc-macro/signature.rs index 6d6b5a23e94..e249c9e9aa2 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/signature.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/signature.rs @@ -18,6 +18,5 @@ pub unsafe extern fn foo(a: i32, b: u32) -> u32 { //~^ ERROR: mismatched types //~| NOTE: expected normal fn, found unsafe fn //~| NOTE: expected type `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` - //~| NOTE: found type `unsafe extern "C" fn(i32, u32) -> u32 {foo}` loop {} } diff --git a/src/test/compile-fail/issue-27942.rs b/src/test/compile-fail/issue-27942.rs index b8552794eb5..595e4bfb0d7 100644 --- a/src/test/compile-fail/issue-27942.rs +++ b/src/test/compile-fail/issue-27942.rs @@ -15,13 +15,11 @@ pub trait Buffer<'a, R: Resources<'a>> { //~^ ERROR mismatched types //~| lifetime mismatch //~| NOTE expected type `Resources<'_>` - //~| NOTE found type `Resources<'a>` //~| NOTE the lifetime 'a as defined on the method body at 14:4... //~| NOTE ...does not necessarily outlive the anonymous lifetime #1 defined on the method body //~| ERROR mismatched types //~| lifetime mismatch //~| NOTE expected type `Resources<'_>` - //~| NOTE found type `Resources<'a>` //~| NOTE the anonymous lifetime #1 defined on the method body at 14:4... //~| NOTE ...does not necessarily outlive the lifetime 'a as defined on the method body } diff --git a/src/test/compile-fail/issue-37884.rs b/src/test/compile-fail/issue-37884.rs index a73b1dbe34c..6e1b9b2fbed 100644 --- a/src/test/compile-fail/issue-37884.rs +++ b/src/test/compile-fail/issue-37884.rs @@ -16,7 +16,6 @@ impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { //~^ ERROR method not compatible with trait //~| lifetime mismatch //~| NOTE expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` - //~| NOTE found type `fn(&'a mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` { //~^ NOTE the anonymous lifetime #1 defined on the body //~| NOTE ...does not necessarily outlive the lifetime 'a as defined on the body diff --git a/src/test/ui/compare-method/reordered-type-param.stderr b/src/test/ui/compare-method/reordered-type-param.stderr index 985b85cc4ec..4620248e2ef 100644 --- a/src/test/ui/compare-method/reordered-type-param.stderr +++ b/src/test/ui/compare-method/reordered-type-param.stderr @@ -8,7 +8,7 @@ error[E0053]: method `b` has an incompatible type for trait | ^ expected type parameter, found a different type parameter | = note: expected type `fn(&E, F) -> F` - = note: found type `fn(&E, G) -> G` + found type `fn(&E, G) -> G` error: aborting due to previous error diff --git a/src/test/compile-fail/E0053.rs b/src/test/ui/mismatched_types/E0053.rs index 933462e553e..933462e553e 100644 --- a/src/test/compile-fail/E0053.rs +++ b/src/test/ui/mismatched_types/E0053.rs diff --git a/src/test/ui/mismatched_types/E0053.stderr b/src/test/ui/mismatched_types/E0053.stderr new file mode 100644 index 00000000000..b6e3d663e36 --- /dev/null +++ b/src/test/ui/mismatched_types/E0053.stderr @@ -0,0 +1,23 @@ +error[E0053]: method `foo` has an incompatible type for trait + --> $DIR/E0053.rs:19:15 + | +12 | fn foo(x: u16); //~ NOTE type in trait + | --- type in trait +... +19 | fn foo(x: i16) { } + | ^^^ expected u16, found i16 + +error[E0053]: method `bar` has an incompatible type for trait + --> $DIR/E0053.rs:22:12 + | +13 | fn bar(&self); //~ NOTE type in trait + | ----- type in trait +... +22 | fn bar(&mut self) { } + | ^^^^^^^^^ types differ in mutability + | + = note: expected type `fn(&Bar)` + found type `fn(&mut Bar)` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/E0409.rs b/src/test/ui/mismatched_types/E0409.rs index e89cc9ea5cb..e89cc9ea5cb 100644 --- a/src/test/compile-fail/E0409.rs +++ b/src/test/ui/mismatched_types/E0409.rs diff --git a/src/test/ui/mismatched_types/E0409.stderr b/src/test/ui/mismatched_types/E0409.stderr new file mode 100644 index 00000000000..251e247fa28 --- /dev/null +++ b/src/test/ui/mismatched_types/E0409.stderr @@ -0,0 +1,19 @@ +error[E0409]: variable `y` is bound with different mode in pattern #2 than in pattern #1 + --> $DIR/E0409.rs:15:23 + | +15 | (0, ref y) | (y, 0) => {} //~ ERROR E0409 + | - ^ bound in different ways + | | + | first binding + +error[E0308]: mismatched types + --> $DIR/E0409.rs:15:23 + | +15 | (0, ref y) | (y, 0) => {} //~ ERROR E0409 + | ^ expected &{integer}, found integral variable + | + = note: expected type `&{integer}` + found type `{integer}` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-19109.rs b/src/test/ui/mismatched_types/issue-19109.rs index 580684e2e14..580684e2e14 100644 --- a/src/test/compile-fail/issue-19109.rs +++ b/src/test/ui/mismatched_types/issue-19109.rs diff --git a/src/test/ui/mismatched_types/issue-19109.stderr b/src/test/ui/mismatched_types/issue-19109.stderr new file mode 100644 index 00000000000..4067507c964 --- /dev/null +++ b/src/test/ui/mismatched_types/issue-19109.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/issue-19109.rs:14:5 + | +14 | t as *mut Trait + | ^^^^^^^^^^^^^^^ expected (), found *-ptr + | + = note: expected type `()` + found type `*mut Trait` + +error: aborting due to previous error + diff --git a/src/test/ui/mismatched_types/issue-35030.stderr b/src/test/ui/mismatched_types/issue-35030.stderr index aa017297a4e..46d690c5f03 100644 --- a/src/test/ui/mismatched_types/issue-35030.stderr +++ b/src/test/ui/mismatched_types/issue-35030.stderr @@ -5,7 +5,7 @@ error[E0308]: mismatched types | ^^^^ expected type parameter, found bool | = note: expected type `bool` (type parameter) - = note: found type `bool` (bool) + found type `bool` (bool) error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr index b0e56094fcf..9efee4cc559 100644 --- a/src/test/ui/mismatched_types/issue-38371.stderr +++ b/src/test/ui/mismatched_types/issue-38371.stderr @@ -5,7 +5,7 @@ error[E0308]: mismatched types | ^^^^ expected struct `Foo`, found reference | = note: expected type `Foo` - = note: found type `&_` + found type `&_` = help: did you mean `foo: &Foo`? error[E0308]: mismatched types @@ -15,7 +15,7 @@ error[E0308]: mismatched types | ^^^^ expected u32, found reference | = note: expected type `u32` - = note: found type `&_` + found type `&_` error[E0308]: mismatched types --> $DIR/issue-38371.rs:31:8 @@ -24,7 +24,7 @@ error[E0308]: mismatched types | ^^^^^ expected u32, found reference | = note: expected type `u32` - = note: found type `&_` + found type `&_` error[E0529]: expected an array or slice, found `u32` --> $DIR/issue-38371.rs:34:9 diff --git a/src/test/ui/mismatched_types/main.stderr b/src/test/ui/mismatched_types/main.stderr index c87b635521e..5dd124ebcdf 100644 --- a/src/test/ui/mismatched_types/main.stderr +++ b/src/test/ui/mismatched_types/main.stderr @@ -7,7 +7,7 @@ error[E0308]: mismatched types | |_____^ ...ending here: expected u32, found () | = note: expected type `u32` - = note: found type `()` + found type `()` error: aborting due to previous error diff --git a/src/test/compile-fail/overloaded-calls-bad.rs b/src/test/ui/mismatched_types/overloaded-calls-bad.rs index 3295e2bebd2..3295e2bebd2 100644 --- a/src/test/compile-fail/overloaded-calls-bad.rs +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.rs diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr new file mode 100644 index 00000000000..cd05684f15d --- /dev/null +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $DIR/overloaded-calls-bad.rs:38:17 + | +38 | let ans = s("what"); //~ ERROR mismatched types + | ^^^^^^ expected isize, found reference + | + = note: expected type `isize` + found type `&'static str` + +error[E0057]: this function takes 1 parameter but 0 parameters were supplied + --> $DIR/overloaded-calls-bad.rs:42:15 + | +42 | let ans = s(); + | ^^^ expected 1 parameter + +error[E0057]: this function takes 1 parameter but 2 parameters were supplied + --> $DIR/overloaded-calls-bad.rs:45:17 + | +45 | let ans = s("burma", "shave"); + | ^^^^^^^^^^^^^^^^ expected 1 parameter + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/trait-bounds-cant-coerce.rs b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs index 9f832c7b6e5..9f832c7b6e5 100644 --- a/src/test/compile-fail/trait-bounds-cant-coerce.rs +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr new file mode 100644 index 00000000000..c47975b0135 --- /dev/null +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/trait-bounds-cant-coerce.rs:24:7 + | +24 | a(x); //~ ERROR mismatched types [E0308] + | ^ expected trait `Foo + std::marker::Send`, found trait `Foo` + | + = note: expected type `Box<Foo + std::marker::Send + 'static>` + found type `Box<Foo + 'static>` + +error: aborting due to previous error + diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 4a0ccc46525..991197c2afb 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -17,7 +17,7 @@ error[E0053]: method `bar` has an incompatible type for trait | ^^^^ types differ in mutability | = note: expected type `fn(&mut Bar, &mut Bar)` - = note: found type `fn(&mut Bar, &Bar)` + found type `fn(&mut Bar, &Bar)` error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index adb88ab572c..56e36889575 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -35,7 +35,7 @@ error[E0308]: mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `std::result::Result` | = note: expected type `()` - = note: found type `std::result::Result<bool, std::io::Error>` + found type `std::result::Result<bool, std::io::Error>` = help: here are some functions which might fulfill your needs: - .unwrap() - .unwrap_err() diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index ed1bcd318a4..c32fefcd0d6 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -5,7 +5,7 @@ error[E0308]: mismatched types | ^^^^^^^^^^^^^ expected usize, found struct `std::string::String` | = note: expected type `usize` - = note: found type `std::string::String` + found type `std::string::String` = help: here are some functions which might fulfill your needs: - .capacity() - .len() @@ -17,7 +17,7 @@ error[E0308]: mismatched types | ^^^^^^^^^^^^^ expected &str, found struct `std::string::String` | = note: expected type `&str` - = note: found type `std::string::String` + found type `std::string::String` = help: here are some functions which might fulfill your needs: - .as_str() - .trim() @@ -31,7 +31,7 @@ error[E0308]: mismatched types | ^^ types differ in mutability | = note: expected type `&mut std::string::String` - = note: found type `&std::string::String` + found type `&std::string::String` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:36:11 @@ -40,7 +40,7 @@ error[E0308]: mismatched types | ^^ types differ in mutability | = note: expected type `&mut i32` - = note: found type `&std::string::String` + found type `&std::string::String` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:42:9 @@ -49,7 +49,7 @@ error[E0308]: mismatched types | ^^^^^ cyclic type of infinite size | = note: expected type `_` - = note: found type `Box<_>` + found type `Box<_>` error: aborting due to 5 previous errors diff --git a/src/test/ui/span/issue-27522.stderr b/src/test/ui/span/issue-27522.stderr index 71130f4947a..117b109780b 100644 --- a/src/test/ui/span/issue-27522.stderr +++ b/src/test/ui/span/issue-27522.stderr @@ -5,7 +5,7 @@ error[E0308]: mismatched method receiver | ^^^^^^^^^ expected Self, found struct `SomeType` | = note: expected type `&Self` - = note: found type `&SomeType` + found type `&SomeType` error: aborting due to previous error diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr index 251feded167..2294e6476d6 100644 --- a/src/test/ui/span/move-closure.stderr +++ b/src/test/ui/span/move-closure.stderr @@ -5,7 +5,7 @@ error[E0308]: mismatched types | ^^^^^^^^^^ expected (), found closure | = note: expected type `()` - = note: found type `[closure@$DIR/move-closure.rs:15:17: 15:27]` + found type `[closure@$DIR/move-closure.rs:15:17: 15:27]` error: aborting due to previous error |
