Skip to content

Commit f36c643

Browse files
committed
Fix impl Trait suggestion
1 parent 50eefc0 commit f36c643

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/librustc_typeck/check/compare_method.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
777777
let new_generics_span = tcx
778778
.sess
779779
.codemap()
780-
.generate_fn_name_span(impl_m.span)?
780+
.generate_fn_name_span(impl_span)?
781781
.shrink_to_hi();
782782
// in case there are generics, just replace them
783783
let generics_span = impl_m

src/test/ui/impl-trait/impl-generic-mismatch.stderr

+2-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ LL | fn bar(&self, _: &impl Debug) { }
2121
| ^^^^^^^^^^ expected generic parameter, found `impl Trait`
2222
help: try changing the `impl Trait` argument to a generic parameter
2323
|
24-
LL | fn bar<U: Debug><U: Debug>(&self, _: &U);
25-
LL | }
26-
LL |
27-
LL | impl Bar for () {
28-
LL | fn bar(&self, _: &U) { }
29-
|
24+
LL | fn bar<U: Debug>(&self, _: &U) { }
25+
| ^^^^^^^^^^ ^
3026

3127
error[E0643]: method `hash` has incompatible signature for trait
3228
--> $DIR/impl-generic-mismatch.rs:38:33

0 commit comments

Comments
 (0)