diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index d185bc6f300..808c134e994 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -777,7 +777,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let new_generics_span = tcx .sess .codemap() - .generate_fn_name_span(impl_m.span)? + .generate_fn_name_span(impl_span)? .shrink_to_hi(); // in case there are generics, just replace them let generics_span = impl_m diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr index d47adee424c..a5f1580b60d 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr @@ -21,12 +21,8 @@ LL | fn bar(&self, _: &impl Debug) { } | ^^^^^^^^^^ expected generic parameter, found `impl Trait` help: try changing the `impl Trait` argument to a generic parameter | -LL | fn bar(&self, _: &U); -LL | } -LL | -LL | impl Bar for () { -LL | fn bar(&self, _: &U) { } - | +LL | fn bar(&self, _: &U) { } + | ^^^^^^^^^^ ^ error[E0643]: method `hash` has incompatible signature for trait --> $DIR/impl-generic-mismatch.rs:38:33