Skip to content

Commit 1c765d6

Browse files
committed
formatted docs stderr | method-output-diff-issue-127263.rs
1 parent db989fc commit 1c765d6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tests/ui/mismatched_types/fn-pointer-mismatch-diagnostics.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
//! This test checks that when there's a type mismatch between a function item and
2+
//! a function pointer, the error message focuses on the actual type difference
3+
//! (return types, argument types) rather than the confusing "pointer vs item" distinction.
4+
//!
5+
//! See https://github.com/rust-lang/rust/issues/127263
6+
17
fn bar() {}
8+
29
fn foo(x: i32) -> u32 {
310
0
411
}
12+
513
fn main() {
614
let b: fn() -> u32 = bar; //~ ERROR mismatched types [E0308]
715
let f: fn(i32) = foo; //~ ERROR mismatched types [E0308]

tests/ui/mismatched_types/fn-pointer-mismatch-diagnostics.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/method-output-diff-issue-127263.rs:6:26
2+
--> $DIR/fn-pointer-mismatch-diagnostics.rs:14:26
33
|
44
LL | let b: fn() -> u32 = bar;
55
| ----------- ^^^ expected fn pointer, found fn item
@@ -10,7 +10,7 @@ LL | let b: fn() -> u32 = bar;
1010
found fn item `fn() -> () {bar}`
1111

1212
error[E0308]: mismatched types
13-
--> $DIR/method-output-diff-issue-127263.rs:7:22
13+
--> $DIR/fn-pointer-mismatch-diagnostics.rs:15:22
1414
|
1515
LL | let f: fn(i32) = foo;
1616
| ------- ^^^ expected fn pointer, found fn item

0 commit comments

Comments
 (0)