about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0746.rs5
-rw-r--r--src/test/ui/error-codes/E0746.stderr40
2 files changed, 4 insertions, 41 deletions
diff --git a/src/test/ui/error-codes/E0746.rs b/src/test/ui/error-codes/E0746.rs
index ad257b01e1b..c9ab455a4c5 100644
--- a/src/test/ui/error-codes/E0746.rs
+++ b/src/test/ui/error-codes/E0746.rs
@@ -5,13 +5,12 @@ impl Trait for u32 {}
 
 fn foo() -> dyn Trait { Struct }
 //~^ ERROR E0746
-//~| ERROR E0308
 
 fn bar() -> dyn Trait { //~ ERROR E0746
     if true {
-        return 0; //~ ERROR E0308
+        return 0;
     }
-    42 //~ ERROR E0308
+    42
 }
 
 fn main() {}
diff --git a/src/test/ui/error-codes/E0746.stderr b/src/test/ui/error-codes/E0746.stderr
index baafcd27c29..44bd0d7ed7d 100644
--- a/src/test/ui/error-codes/E0746.stderr
+++ b/src/test/ui/error-codes/E0746.stderr
@@ -1,14 +1,3 @@
-error[E0308]: mismatched types
-  --> $DIR/E0746.rs:6:25
-   |
-LL | fn foo() -> dyn Trait { Struct }
-   |             ---------   ^^^^^^ expected trait `Trait`, found struct `Struct`
-   |             |
-   |             expected `(dyn Trait + 'static)` because of return type
-   |
-   = note: expected trait object `(dyn Trait + 'static)`
-                    found struct `Struct`
-
 error[E0746]: return type cannot have a bare trait because it must be `Sized`
   --> $DIR/E0746.rs:6:13
    |
@@ -22,7 +11,7 @@ LL | fn foo() -> impl Trait { Struct }
    |             ^^^^^^^^^^
 
 error[E0746]: return type cannot have a bare trait because it must be `Sized`
-  --> $DIR/E0746.rs:10:13
+  --> $DIR/E0746.rs:9:13
    |
 LL | fn bar() -> dyn Trait {
    |             ^^^^^^^^^ doesn't have a size known at compile-time
@@ -33,30 +22,5 @@ help: you can use the `impl Trait` feature in the return type because all the re
 LL | fn bar() -> impl Trait {
    |             ^^^^^^^^^^
 
-error[E0308]: mismatched types
-  --> $DIR/E0746.rs:12:16
-   |
-LL | fn bar() -> dyn Trait {
-   |             --------- expected `(dyn Trait + 'static)` because of return type
-LL |     if true {
-LL |         return 0;
-   |                ^ expected trait `Trait`, found integer
-   |
-   = note: expected trait object `(dyn Trait + 'static)`
-                      found type `{integer}`
-
-error[E0308]: mismatched types
-  --> $DIR/E0746.rs:14:5
-   |
-LL | fn bar() -> dyn Trait {
-   |             --------- expected `(dyn Trait + 'static)` because of return type
-...
-LL |     42
-   |     ^^ expected trait `Trait`, found integer
-   |
-   = note: expected trait object `(dyn Trait + 'static)`
-                      found type `{integer}`
-
-error: aborting due to 5 previous errors
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0308`.