Skip to content

Commit 6960391

Browse files
authored
Rollup merge of rust-lang#155900 - theemathas:fndef-is-function-item, r=Kivooeo
Refer to `FnDef` as "function item", not "function pointer"
2 parents a288e8c + 6f2e501 commit 6960391

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
533533
ty::FnDef(def_id, _) => {
534534
let name = self.infcx.tcx.item_name(*def_id);
535535
let identity_args = GenericArgs::identity_for_item(self.infcx.tcx, *def_id);
536-
let desc = format!("a function pointer to `{name}`");
536+
let desc = format!("the function item type defined by `{name}`");
537537
let note = format!(
538538
"the function `{name}` is invariant over the parameter `{}`",
539539
identity_args[param_index as usize]

tests/ui/fn/fn_def_coercion.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | let mut x = foo::<&'a ()>;
99
| ^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
1010
|
1111
= help: consider adding the following bound: `'b: 'a`
12-
= note: requirement occurs because of a function pointer to `foo`
12+
= note: requirement occurs because of the function item type defined by `foo`
1313
= note: the function `foo` is invariant over the parameter `T`
1414
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
1515

@@ -25,7 +25,7 @@ LL | x = foo::<&'b ()>;
2525
| ^^^^^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
2626
|
2727
= help: consider adding the following bound: `'a: 'b`
28-
= note: requirement occurs because of a function pointer to `foo`
28+
= note: requirement occurs because of the function item type defined by `foo`
2929
= note: the function `foo` is invariant over the parameter `T`
3030
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
3131

@@ -56,7 +56,7 @@ LL | x = foo::<&'b ()>;
5656
| ^^^^^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
5757
|
5858
= help: consider adding the following bound: `'a: 'b`
59-
= note: requirement occurs because of a function pointer to `foo`
59+
= note: requirement occurs because of the function item type defined by `foo`
6060
= note: the function `foo` is invariant over the parameter `T`
6161
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
6262

@@ -72,7 +72,7 @@ LL | x = foo::<&'a ()>;
7272
| ^^^^^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
7373
|
7474
= help: consider adding the following bound: `'b: 'a`
75-
= note: requirement occurs because of a function pointer to `foo`
75+
= note: requirement occurs because of the function item type defined by `foo`
7676
= note: the function `foo` is invariant over the parameter `T`
7777
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
7878

@@ -92,7 +92,7 @@ LL | true => foo::<&'b ()>,
9292
| ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
9393
|
9494
= help: consider adding the following bound: `'a: 'b`
95-
= note: requirement occurs because of a function pointer to `foo`
95+
= note: requirement occurs because of the function item type defined by `foo`
9696
= note: the function `foo` is invariant over the parameter `T`
9797
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
9898

@@ -108,7 +108,7 @@ LL | false => foo::<&'a ()>,
108108
| ^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
109109
|
110110
= help: consider adding the following bound: `'b: 'a`
111-
= note: requirement occurs because of a function pointer to `foo`
111+
= note: requirement occurs because of the function item type defined by `foo`
112112
= note: the function `foo` is invariant over the parameter `T`
113113
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
114114

@@ -128,7 +128,7 @@ LL | true => foo::<&'c ()>,
128128
| ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'c`
129129
|
130130
= help: consider adding the following bound: `'a: 'c`
131-
= note: requirement occurs because of a function pointer to `foo`
131+
= note: requirement occurs because of the function item type defined by `foo`
132132
= note: the function `foo` is invariant over the parameter `T`
133133
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
134134

@@ -144,7 +144,7 @@ LL | false => foo::<&'a ()>,
144144
| ^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
145145
|
146146
= help: consider adding the following bound: `'b: 'a`
147-
= note: requirement occurs because of a function pointer to `foo`
147+
= note: requirement occurs because of the function item type defined by `foo`
148148
= note: the function `foo` is invariant over the parameter `T`
149149
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
150150

0 commit comments

Comments
 (0)