about summary refs log tree commit diff
path: root/src/test/ui/impl-trait
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-21 17:53:19 +0000
committerbors <bors@rust-lang.org>2019-11-21 17:53:19 +0000
commit53712f8637dbe326df569a90814aae1cc5429710 (patch)
tree3ffee9436fa178bcc3d74251c686074cbd8a4c04 /src/test/ui/impl-trait
parent35ef33a89dfd8ff8c8a7b3c58fa7136bbcb2f1ed (diff)
parent468722b33c589ade04a11f05f53d0f3bff6c7a99 (diff)
downloadrust-53712f8637dbe326df569a90814aae1cc5429710.tar.gz
rust-53712f8637dbe326df569a90814aae1cc5429710.zip
Auto merge of #66389 - estebank:type-err-labels, r=petrochenkov
Specific labels when referring to "expected" and "found" types
Diffstat (limited to 'src/test/ui/impl-trait')
-rw-r--r--src/test/ui/impl-trait/bound-normalization-fail.stderr12
-rw-r--r--src/test/ui/impl-trait/equality.rs2
-rw-r--r--src/test/ui/impl-trait/equality.stderr5
-rw-r--r--src/test/ui/impl-trait/equality2.rs12
-rw-r--r--src/test/ui/impl-trait/equality2.stderr24
-rw-r--r--src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr4
-rw-r--r--src/test/ui/impl-trait/trait_type.stderr4
-rw-r--r--src/test/ui/impl-trait/universal-mismatched-type.stderr4
-rw-r--r--src/test/ui/impl-trait/universal-two-impl-traits.stderr4
9 files changed, 34 insertions, 37 deletions
diff --git a/src/test/ui/impl-trait/bound-normalization-fail.stderr b/src/test/ui/impl-trait/bound-normalization-fail.stderr
index 99c6a8cdd6d..fc4cddd0216 100644
--- a/src/test/ui/impl-trait/bound-normalization-fail.stderr
+++ b/src/test/ui/impl-trait/bound-normalization-fail.stderr
@@ -10,10 +10,10 @@ error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as imp
   --> $DIR/bound-normalization-fail.rs:28:32
    |
 LL |     fn foo_fail<T: Trait>() -> impl FooLike<Output=T::Assoc> {
-   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found associated type
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
    |
-   = note: expected type `()`
-              found type `<T as impl_trait::Trait>::Assoc`
+   = note:         expected type `()`
+           found associated type `<T as impl_trait::Trait>::Assoc`
    = note: consider constraining the associated type `<T as impl_trait::Trait>::Assoc` to `()`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
    = note: the return type of a function must have a statically known size
@@ -28,10 +28,10 @@ error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lif
   --> $DIR/bound-normalization-fail.rs:44:41
    |
 LL |     fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output=T::Assoc> {
-   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found associated type
+   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
    |
-   = note: expected type `()`
-              found type `<T as lifetimes::Trait<'static>>::Assoc`
+   = note:         expected type `()`
+           found associated type `<T as lifetimes::Trait<'static>>::Assoc`
    = note: consider constraining the associated type `<T as lifetimes::Trait<'static>>::Assoc` to `()`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
    = note: the return type of a function must have a statically known size
diff --git a/src/test/ui/impl-trait/equality.rs b/src/test/ui/impl-trait/equality.rs
index f6b0853284d..14b0eeb739a 100644
--- a/src/test/ui/impl-trait/equality.rs
+++ b/src/test/ui/impl-trait/equality.rs
@@ -14,7 +14,7 @@ fn two(x: bool) -> impl Foo {
     }
     0_u32
     //~^ ERROR mismatched types
-    //~| expected i32, found u32
+    //~| expected `i32`, found `u32`
 }
 
 fn sum_to(n: u32) -> impl Foo {
diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr
index 7bb2d7d47a5..e53524e58d6 100644
--- a/src/test/ui/impl-trait/equality.stderr
+++ b/src/test/ui/impl-trait/equality.stderr
@@ -8,10 +8,7 @@ LL |         return 1_i32;
    |                ----- ...is found to be `i32` here
 LL |     }
 LL |     0_u32
-   |     ^^^^^ expected i32, found u32
-   |
-   = note: expected type `i32`
-              found type `u32`
+   |     ^^^^^ expected `i32`, found `u32`
 
 error[E0277]: cannot add `impl Foo` to `u32`
   --> $DIR/equality.rs:24:11
diff --git a/src/test/ui/impl-trait/equality2.rs b/src/test/ui/impl-trait/equality2.rs
index a01779e8fcd..abce8c8c204 100644
--- a/src/test/ui/impl-trait/equality2.rs
+++ b/src/test/ui/impl-trait/equality2.rs
@@ -25,20 +25,20 @@ fn main() {
     let _: u32 = hide(0_u32);
     //~^ ERROR mismatched types
     //~| expected type `u32`
-    //~| found type `impl Foo`
-    //~| expected u32, found opaque type
+    //~| found opaque type `impl Foo`
+    //~| expected `u32`, found opaque type
 
     let _: i32 = Leak::leak(hide(0_i32));
     //~^ ERROR mismatched types
     //~| expected type `i32`
-    //~| found type `<impl Foo as Leak>::T`
-    //~| expected i32, found associated type
+    //~| found associated type `<impl Foo as Leak>::T`
+    //~| expected `i32`, found associated type
 
     let mut x = (hide(0_u32), hide(0_i32));
     x = (x.1,
     //~^ ERROR mismatched types
-    //~| expected u32, found i32
+    //~| expected `u32`, found `i32`
          x.0);
     //~^ ERROR mismatched types
-    //~| expected i32, found u32
+    //~| expected `i32`, found `u32`
 }
diff --git a/src/test/ui/impl-trait/equality2.stderr b/src/test/ui/impl-trait/equality2.stderr
index e30e2626e9f..7a656fca28b 100644
--- a/src/test/ui/impl-trait/equality2.stderr
+++ b/src/test/ui/impl-trait/equality2.stderr
@@ -2,19 +2,19 @@ error[E0308]: mismatched types
   --> $DIR/equality2.rs:25:18
    |
 LL |     let _: u32 = hide(0_u32);
-   |                  ^^^^^^^^^^^ expected u32, found opaque type
+   |                  ^^^^^^^^^^^ expected `u32`, found opaque type
    |
-   = note: expected type `u32`
-              found type `impl Foo`
+   = note:     expected type `u32`
+           found opaque type `impl Foo`
 
 error[E0308]: mismatched types
   --> $DIR/equality2.rs:31:18
    |
 LL |     let _: i32 = Leak::leak(hide(0_i32));
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found associated type
+   |                  ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found associated type
    |
-   = note: expected type `i32`
-              found type `<impl Foo as Leak>::T`
+   = note:         expected type `i32`
+           found associated type `<impl Foo as Leak>::T`
    = note: consider constraining the associated type `<impl Foo as Leak>::T` to `i32`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
 
@@ -22,19 +22,19 @@ error[E0308]: mismatched types
   --> $DIR/equality2.rs:38:10
    |
 LL |     x = (x.1,
-   |          ^^^ expected u32, found i32
+   |          ^^^ expected `u32`, found `i32`
    |
-   = note: expected type `impl Foo` (u32)
-              found type `impl Foo` (i32)
+   = note: expected opaque type `impl Foo` (`u32`)
+              found opaque type `impl Foo` (`i32`)
 
 error[E0308]: mismatched types
   --> $DIR/equality2.rs:41:10
    |
 LL |          x.0);
-   |          ^^^ expected i32, found u32
+   |          ^^^ expected `i32`, found `u32`
    |
-   = note: expected type `impl Foo` (i32)
-              found type `impl Foo` (u32)
+   = note: expected opaque type `impl Foo` (`i32`)
+              found opaque type `impl Foo` (`u32`)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr b/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr
index 7cb4677a2b1..638a0093fb2 100644
--- a/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr
+++ b/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr
@@ -9,8 +9,8 @@ LL |     fn foo<B: Debug>(&self, a: &impl Debug, b: &B) { }
    |            |
    |            expected type parameter
    |
-   = note: expected type `fn(&(), &B, &impl Debug)`
-              found type `fn(&(), &impl Debug, &B)`
+   = note: expected fn pointer `fn(&(), &B, &impl Debug)`
+              found fn pointer `fn(&(), &impl Debug, &B)`
    = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
    = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
 
diff --git a/src/test/ui/impl-trait/trait_type.stderr b/src/test/ui/impl-trait/trait_type.stderr
index 151dc681621..d95b62e469e 100644
--- a/src/test/ui/impl-trait/trait_type.stderr
+++ b/src/test/ui/impl-trait/trait_type.stderr
@@ -4,8 +4,8 @@ error[E0053]: method `fmt` has an incompatible type for trait
 LL |    fn fmt(&self, x: &str) -> () { }
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
    |
-   = note: expected type `fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
-              found type `fn(&MyType, &str)`
+   = note: expected fn pointer `fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
+              found fn pointer `fn(&MyType, &str)`
 
 error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2
   --> $DIR/trait_type.rs:12:11
diff --git a/src/test/ui/impl-trait/universal-mismatched-type.stderr b/src/test/ui/impl-trait/universal-mismatched-type.stderr
index ae20a5aa883..3ffa2b55712 100644
--- a/src/test/ui/impl-trait/universal-mismatched-type.stderr
+++ b/src/test/ui/impl-trait/universal-mismatched-type.stderr
@@ -8,8 +8,8 @@ LL | fn foo(x: impl Debug) -> String {
 LL |     x
    |     ^ expected struct `std::string::String`, found type parameter `impl Debug`
    |
-   = note: expected type `std::string::String`
-              found type `impl Debug`
+   = note:      expected struct `std::string::String`
+           found type parameter `impl Debug`
    = help: type parameters must be constrained to match other types
    = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
 
diff --git a/src/test/ui/impl-trait/universal-two-impl-traits.stderr b/src/test/ui/impl-trait/universal-two-impl-traits.stderr
index f540d319a27..7c120235fd1 100644
--- a/src/test/ui/impl-trait/universal-two-impl-traits.stderr
+++ b/src/test/ui/impl-trait/universal-two-impl-traits.stderr
@@ -9,8 +9,8 @@ LL |     let mut a = x;
 LL |     a = y;
    |         ^ expected type parameter `impl Debug`, found a different type parameter `impl Debug`
    |
-   = note: expected type `impl Debug` (type parameter `impl Debug`)
-              found type `impl Debug` (type parameter `impl Debug`)
+   = note: expected type parameter `impl Debug` (type parameter `impl Debug`)
+              found type parameter `impl Debug` (type parameter `impl Debug`)
    = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
    = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters