diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 1ee535b68b0..cebb9d09a47 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -1168,17 +1168,12 @@ fn cmp_fn_sig( let output1 = sig1.output(); let output2 = sig2.output(); let (x1, x2) = self.cmp(output1, output2); - let only_output_diff = !lifetime_diff - && sig1.c_variadic == sig2.c_variadic - && sig1.safety == sig2.safety - && sig1.abi == sig2.abi - && sig1.inputs() == sig2.inputs() - && x1 != x2; - if !output1.is_unit() || only_output_diff { + let output_diff = x1 != x2; + if !output1.is_unit() || output_diff { values.0.push_normal(" -> "); (values.0).0.extend(x1.0); } - if !output2.is_unit() || only_output_diff { + if !output2.is_unit() || output_diff { values.1.push_normal(" -> "); (values.1).0.extend(x2.0); } diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 06a606b09dc..584724dfe59 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -92,7 +92,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} | ^^^^ expected `&Foo`, found `Foo` | = note: expected signature `extern "rust-call" fn(&Foo, ()) -> _` - found signature `extern "rust-call" fn(Foo, ())` + found signature `extern "rust-call" fn(Foo, ()) -> ()` help: change the self-receiver type to match the trait | LL | extern "rust-call" fn call(&self, args: ()) -> () {} @@ -162,7 +162,7 @@ LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} | ^^^^^ types differ in mutability | = note: expected signature `extern "rust-call" fn(&mut Bar, ()) -> _` - found signature `extern "rust-call" fn(&Bar, ())` + found signature `extern "rust-call" fn(&Bar, ()) -> ()` help: change the self-receiver type to match the trait | LL | extern "rust-call" fn call_mut(&mut self, args: ()) -> () {} diff --git a/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr b/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr index 0b3331b040d..5000601e90f 100644 --- a/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr +++ b/tests/ui/fn/fn_def_opaque_coercion_to_fn_ptr.stderr @@ -10,7 +10,7 @@ LL | x = foo::<()>; | ^^^^^^^^^ expected fn item, found a different fn item | = note: expected fn item `fn(F) -> F {bar::}` - found fn item `fn(()) {foo::<()>}` + found fn item `fn(()) -> () {foo::<()>}` error[E0308]: mismatched types --> $DIR/fn_def_opaque_coercion_to_fn_ptr.rs:27:9 @@ -26,7 +26,7 @@ LL | let mut x = bar::<()>; LL | x = foo::; | ^^^^^^^^ expected fn item, found a different fn item | - = note: expected fn item `fn(()) {bar::<()>}` + = note: expected fn item `fn(()) -> () {bar::<()>}` found fn item `fn(I) -> I {foo::}` help: use parentheses to call this function | diff --git a/tests/ui/impl-trait/trait_type.stderr b/tests/ui/impl-trait/trait_type.stderr index 0eb132c7a19..989779a6178 100644 --- a/tests/ui/impl-trait/trait_type.stderr +++ b/tests/ui/impl-trait/trait_type.stderr @@ -5,7 +5,7 @@ LL | fn fmt(&self, x: &str) -> () { } | ^^^^ types differ in mutability | = note: expected signature `fn(&MyType, &mut Formatter<'_>) -> Result<(), std::fmt::Error>` - found signature `fn(&MyType, &str)` + found signature `fn(&MyType, &str) -> ()` help: change the parameter type to match the trait | LL | fn fmt(&self, x: &mut Formatter<'_>) -> () { } diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr index 812f7a0692f..4fea52fec6e 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr +++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr @@ -5,7 +5,7 @@ LL | fn panic(info: PanicInfo) -> () {} | ^^^^^^^^^ expected `&PanicInfo<'_>`, found `PanicInfo<'_>` | = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> !` - found signature `for<'a> fn(PanicInfo<'a>)` + found signature `for<'a> fn(PanicInfo<'a>) -> ()` error: aborting due to 1 previous error diff --git a/tests/ui/traits/impl-method-mismatch.stderr b/tests/ui/traits/impl-method-mismatch.stderr index 77d542c729a..db457b77a23 100644 --- a/tests/ui/traits/impl-method-mismatch.stderr +++ b/tests/ui/traits/impl-method-mismatch.stderr @@ -10,7 +10,7 @@ note: type in trait LL | fn jumbo(&self, x: &usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: expected signature `fn(&_, &_) -> usize` - found signature `unsafe fn(&_, &_)` + found signature `unsafe fn(&_, &_) -> ()` error: aborting due to 1 previous error