about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-05-24 10:01:13 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-05-24 10:01:13 -0700
commitf36c643d4ff76f5d96304d31bdde45152e4e602e (patch)
tree4785ce26c1817e7f55cbf54dd1d80aa855209bdc /src
parent50eefc0d777a70ff8d11cfd358eb0ed36f6e0651 (diff)
downloadrust-f36c643d4ff76f5d96304d31bdde45152e4e602e.tar.gz
rust-f36c643d4ff76f5d96304d31bdde45152e4e602e.zip
Fix impl Trait suggestion
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/check/compare_method.rs2
-rw-r--r--src/test/ui/impl-trait/impl-generic-mismatch.stderr8
2 files changed, 3 insertions, 7 deletions
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<U: Debug><U: Debug>(&self, _: &U);
-LL | }
-LL | 
-LL | impl Bar for () {
-LL |     fn bar(&self, _: &U) { }
-   |
+LL |     fn bar<U: Debug>(&self, _: &U) { }
+   |           ^^^^^^^^^^            ^
 
 error[E0643]: method `hash` has incompatible signature for trait
   --> $DIR/impl-generic-mismatch.rs:38:33