File tree 4 files changed +51
-2
lines changed
src/test/ui/compare-method
4 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -187,8 +187,12 @@ impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> {
187
187
} )
188
188
. enumerate ( )
189
189
. map ( |( i, r) | match r {
190
- Err ( TypeError :: Sorts ( exp_found) ) => Err ( TypeError :: ArgumentSorts ( exp_found, i) ) ,
191
- Err ( TypeError :: Mutability ) => Err ( TypeError :: ArgumentMutability ( i) ) ,
190
+ Err ( TypeError :: Sorts ( exp_found) | TypeError :: ArgumentSorts ( exp_found, _) ) => {
191
+ Err ( TypeError :: ArgumentSorts ( exp_found, i) )
192
+ }
193
+ Err ( TypeError :: Mutability | TypeError :: ArgumentMutability ( _) ) => {
194
+ Err ( TypeError :: ArgumentMutability ( i) )
195
+ }
192
196
r => r,
193
197
} ) ;
194
198
Ok ( ty:: FnSig {
Original file line number Diff line number Diff line change @@ -453,6 +453,7 @@ fn check_region_bounds_on_impl_item<'tcx>(
453
453
Ok ( ( ) )
454
454
}
455
455
456
+ #[ instrument( level = "debug" , skip( infcx) ) ]
456
457
fn extract_spans_for_error_reporting < ' a , ' tcx > (
457
458
infcx : & infer:: InferCtxt < ' a , ' tcx > ,
458
459
terr : & TypeError < ' _ > ,
Original file line number Diff line number Diff line change
1
+ pub struct A ;
2
+ impl From < fn ( ( ) , ( ) , & ( ) ) > for A {
3
+ fn from ( _: fn ( ( ) , ( ) , & mut ( ) ) ) -> Self {
4
+ //~^ error: method `from` has an incompatible type for trait
5
+ loop { }
6
+ }
7
+ }
8
+
9
+ pub struct B ;
10
+ impl From < fn ( ( ) , ( ) , u32 ) > for B {
11
+ fn from ( _: fn ( ( ) , ( ) , u64 ) ) -> Self {
12
+ //~^ error: method `from` has an incompatible type for trait
13
+ loop { }
14
+ }
15
+ }
16
+
17
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0053]: method `from` has an incompatible type for trait
2
+ --> $DIR/issue-90444.rs:3:16
3
+ |
4
+ LL | fn from(_: fn((), (), &mut ())) -> Self {
5
+ | ^^^^^^^^^^^^^^^^^^^
6
+ | |
7
+ | types differ in mutability
8
+ | help: change the parameter type to match the trait: `for<'r> fn((), (), &'r ())`
9
+ |
10
+ = note: expected fn pointer `fn(for<'r> fn((), (), &'r ())) -> A`
11
+ found fn pointer `fn(for<'r> fn((), (), &'r mut ())) -> A`
12
+
13
+ error[E0053]: method `from` has an incompatible type for trait
14
+ --> $DIR/issue-90444.rs:11:16
15
+ |
16
+ LL | fn from(_: fn((), (), u64)) -> Self {
17
+ | ^^^^^^^^^^^^^^^
18
+ | |
19
+ | expected `u32`, found `u64`
20
+ | help: change the parameter type to match the trait: `fn((), (), u32)`
21
+ |
22
+ = note: expected fn pointer `fn(fn((), (), u32)) -> B`
23
+ found fn pointer `fn(fn((), (), u64)) -> B`
24
+
25
+ error: aborting due to 2 previous errors
26
+
27
+ For more information about this error, try `rustc --explain E0053`.
You can’t perform that action at this time.
0 commit comments