Skip to content

Commit 0848309

Browse files
committed
use "function" rather than "fn pointer" in diagnostic message
Resolves rust-lang#80929.
1 parent e7c23ab commit 0848309

File tree

11 files changed

+12
-12
lines changed

11 files changed

+12
-12
lines changed

compiler/rustc_middle/src/ty/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<'tcx> ty::TyS<'tcx> {
261261
}
262262
}
263263
ty::FnDef(..) => "fn item".into(),
264-
ty::FnPtr(_) => "fn pointer".into(),
264+
ty::FnPtr(_) => "functionr".into(),
265265
ty::Dynamic(ref inner, ..) => {
266266
if let Some(principal) = inner.principal() {
267267
format!("trait object `dyn {}`", tcx.def_path_str(principal.def_id())).into()

src/test/ui/closures/closure-no-fn-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/closure-no-fn-1.rs:6:29
33
|
44
LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
5-
| ------------ ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure
5+
| ------------ ^^^^^^^^^^^^^^^^^^^^^ expected functionr, found closure
66
| |
77
| expected due to this
88
|

src/test/ui/closures/closure-no-fn-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/closure-no-fn-2.rs:6:27
33
|
44
LL | let bar: fn() -> u8 = || { b };
5-
| ---------- ^^^^^^^^ expected fn pointer, found closure
5+
| ---------- ^^^^^^^^ expected functionr, found closure
66
| |
77
| expected due to this
88
|

src/test/ui/closures/closure-no-fn-4.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let _: fn(usize) -> usize = match true {
66
LL | | true => |a| a + 1,
77
| | --------- this is found to be of type `fn(usize) -> usize`
88
LL | | false => |a| a - b,
9-
| | ^^^^^^^^^ expected fn pointer, found closure
9+
| | ^^^^^^^^^ expected functionr, found closure
1010
LL | |
1111
LL | | };
1212
| |_____- `match` arms have incompatible types

src/test/ui/closures/closure-no-fn-5.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/closure-no-fn-5.rs:10:27
33
|
44
LL | let bar: fn() -> u8 = || { a; b; c; d; e };
5-
| ---------- ^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure
5+
| ---------- ^^^^^^^^^^^^^^^^^^^^ expected functionr, found closure
66
| |
77
| expected due to this
88
|

src/test/ui/closures/closure-reform-bad.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
44
LL | let f = |s: &str| println!("{}{}", s, string);
55
| ------------------------------------- the found closure
66
LL | call_bare(f)
7-
| ^ expected fn pointer, found closure
7+
| ^ expected functionr, found closure
88
|
99
= note: expected fn pointer `for<'r> fn(&'r str)`
1010
found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50]`

src/test/ui/closures/print/closure-print-verbose.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/closure-print-verbose.rs:10:29
33
|
44
LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
5-
| ------------ ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure
5+
| ------------ ^^^^^^^^^^^^^^^^^^^^^ expected functionr, found closure
66
| |
77
| expected due to this
88
|

src/test/ui/fn/fn-item-type.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ error[E0308]: mismatched types
5050
--> $DIR/fn-item-type.rs:46:19
5151
|
5252
LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
53-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found functionr
5454
|
5555
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
5656
found fn pointer `fn(_) -> _`

src/test/ui/issues/issue-24322.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/issue-24322.rs:8:29
33
|
44
LL | let x: &fn(&B) -> u32 = &B::func;
5-
| -------------- ^^^^^^^^ expected fn pointer, found fn item
5+
| -------------- ^^^^^^^^ expected functionr, found fn item
66
| |
77
| expected due to this
88
|

src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ error[E0308]: mismatched types
660660
--> $DIR/disallowed-positions.rs:78:12
661661
|
662662
LL | if let Range { start: F, end } = F..|| true {}
663-
| ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range`
663+
| ^^^^^^^^^^^^^^^^^^^^^^^ expected functionr, found struct `std::ops::Range`
664664
|
665665
= note: expected fn pointer `fn() -> bool`
666666
found struct `std::ops::Range<_>`
@@ -848,7 +848,7 @@ error[E0308]: mismatched types
848848
--> $DIR/disallowed-positions.rs:142:15
849849
|
850850
LL | while let Range { start: F, end } = F..|| true {}
851-
| ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range`
851+
| ^^^^^^^^^^^^^^^^^^^^^^^ expected functionr, found struct `std::ops::Range`
852852
|
853853
= note: expected fn pointer `fn() -> bool`
854854
found struct `std::ops::Range<_>`

src/test/ui/static/static-reference-to-fn-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/static-reference-to-fn-1.rs:17:15
33
|
44
LL | func: &foo,
5-
| ^^^^ expected fn pointer, found fn item
5+
| ^^^^ expected functionr, found fn item
66
|
77
= note: expected reference `&fn() -> Option<isize>`
88
found reference `&fn() -> Option<isize> {foo}`

0 commit comments

Comments
 (0)