summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_infer/messages.ftl
blob: 46558997f72365dd617c33b43be2cd132a897395 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
infer_actual_impl_expl_but_actually_implemented_for_ty = ...but `{$trait_path}` is actually implemented for the type `{$ty}`{$has_lifetime ->
    [true] , for some specific lifetime `'{$lifetime}`
    *[false] {""}
}
infer_actual_impl_expl_but_actually_implements_trait = ...but it actually implements `{$trait_path}`{$has_lifetime ->
    [true] , for some specific lifetime `'{$lifetime}`
    *[false] {""}
}
infer_actual_impl_expl_but_actually_ty_implements = ...but `{$ty}` actually implements `{$trait_path}`{$has_lifetime ->
    [true] , for some specific lifetime `'{$lifetime}`
    *[false] {""}
}

infer_actual_impl_expl_expected_other_any = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}`{$ty_or_sig}` must implement `{$trait_path}`, for any lifetime `'{$lifetime_1}`...
infer_actual_impl_expl_expected_other_nothing = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}`{$ty_or_sig}` must implement `{$trait_path}`

infer_actual_impl_expl_expected_other_some = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}`{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime `'{$lifetime_1}`...
infer_actual_impl_expl_expected_other_two = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}`{$ty_or_sig}` must implement `{$trait_path}`, for any two lifetimes `'{$lifetime_1}` and `'{$lifetime_2}`...
infer_actual_impl_expl_expected_passive_any = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for any lifetime `'{$lifetime_1}`...
infer_actual_impl_expl_expected_passive_nothing = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`
infer_actual_impl_expl_expected_passive_some = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for some specific lifetime `'{$lifetime_1}`...
infer_actual_impl_expl_expected_passive_two = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for any two lifetimes `'{$lifetime_1}` and `'{$lifetime_2}`...
infer_actual_impl_expl_expected_signature_any = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for any lifetime `'{$lifetime_1}`...
infer_actual_impl_expl_expected_signature_nothing = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}closure with signature `{$ty_or_sig}` must implement `{$trait_path}`
infer_actual_impl_expl_expected_signature_some = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime `'{$lifetime_1}`...
infer_actual_impl_expl_expected_signature_two = {$leading_ellipsis ->
    [true] ...
    *[false] {""}
}closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for any two lifetimes `'{$lifetime_1}` and `'{$lifetime_2}`...
infer_ascribe_user_type_prove_predicate = ...so that the where clause holds

infer_await_both_futures = consider `await`ing on both `Future`s
infer_await_future = consider `await`ing on the `Future`
infer_await_note = calling an async function returns a future

infer_borrowed_too_long = a value of type `{$ty}` is borrowed for too long
infer_but_calling_introduces = {$has_param_name ->
    [true] `{$param_name}`
    *[false] `fn` parameter
} has {$lifetime_kind ->
    [true] lifetime `{$lifetime}`
    *[false] an anonymous lifetime `'_`
} but calling `{$assoc_item}` introduces an implicit `'static` lifetime requirement
    .label1 = {$has_lifetime ->
        [true] lifetime `{$lifetime}`
        *[false] an anonymous lifetime `'_`
    }
    .label2 = ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the {$has_impl_path ->
        [true] `impl` of `{$impl_path}`
        *[false] inherent `impl`
    }

infer_but_needs_to_satisfy = {$has_param_name ->
    [true] `{$param_name}`
    *[false] `fn` parameter
} has {$has_lifetime ->
    [true] lifetime `{$lifetime}`
    *[false] an anonymous lifetime `'_`
} but it needs to satisfy a `'static` lifetime requirement
    .influencer = this data with {$has_lifetime ->
        [true] lifetime `{$lifetime}`
        *[false] an anonymous lifetime `'_`
    }...
    .require = {$spans_empty ->
        *[true] ...is used and required to live as long as `'static` here
        [false] ...and is required to live as long as `'static` here
    }
    .used_here = ...is used here...
    .introduced_by_bound = `'static` lifetime requirement introduced by this bound

infer_compare_impl_item_obligation = ...so that the definition in impl matches the definition from the trait
infer_consider_specifying_length = consider specifying the actual array length
infer_data_flows = ...but data{$label_var1_exists ->
    [true] {" "}from `{$label_var1}`
    *[false] -> {""}
} flows{$label_var2_exists ->
    [true] {" "}into `{$label_var2}`
    *[false] -> {""}
} here

infer_data_lifetime_flow = ...but data with one lifetime flows into the other here
infer_data_returned = ...but data{$label_var1_exists ->
    [true] {" "}from `{$label_var1}`
    *[false] {""}
} is returned here

infer_declared_different = this parameter and the return type are declared with different lifetimes...
infer_declared_multiple = this type is declared with multiple lifetimes...
infer_does_not_outlive_static_from_impl = ...does not necessarily outlive the static lifetime introduced by the compatible `impl`
infer_dtcs_has_lifetime_req_label = this has an implicit `'static` lifetime requirement
infer_dtcs_has_req_note = the used `impl` has a `'static` requirement
infer_dtcs_introduces_requirement = calling this method introduces the `impl`'s `'static` requirement
infer_dtcs_suggestion = consider relaxing the implicit `'static` requirement

infer_explicit_lifetime_required_sugg_with_ident = add explicit lifetime `{$named}` to the type of `{$simple_ident}`

infer_explicit_lifetime_required_sugg_with_param_type = add explicit lifetime `{$named}` to type

infer_explicit_lifetime_required_with_ident = explicit lifetime required in the type of `{$simple_ident}`
    .label = lifetime `{$named}` required

infer_explicit_lifetime_required_with_param_type = explicit lifetime required in parameter type
    .label = lifetime `{$named}` required

infer_fn_consider_casting = consider casting the fn item to a fn pointer: `{$casting}`

infer_fn_uniq_types = different fn items have unique types, even if their signatures are the same
infer_fps_cast = consider casting to a fn pointer
infer_fps_cast_both = consider casting both fn items to fn pointers using `as {$expected_sig}`

infer_fps_items_are_distinct = fn items are distinct from fn pointers
infer_fps_remove_ref = consider removing the reference
infer_fps_use_ref = consider using a reference
infer_fulfill_req_lifetime = the type `{$ty}` does not fulfill the required lifetime
infer_implicit_static_lifetime_note = this has an implicit `'static` lifetime requirement
infer_implicit_static_lifetime_suggestion = consider relaxing the implicit `'static` requirement
infer_label_bad = {$bad_kind ->
    *[other] cannot infer type
    [more_info] cannot infer {$prefix_kind ->
        *[type] type for {$prefix}
        [const_with_param] the value of const parameter
        [const] the value of the constant
    } `{$name}`{$has_parent ->
        [true] {" "}declared on the {$parent_prefix} `{$parent_name}`
        *[false] {""}
    }
}

infer_lf_bound_not_satisfied = lifetime bound not satisfied
infer_lifetime_mismatch = lifetime mismatch

infer_lifetime_param_suggestion = consider introducing a named lifetime parameter{$is_impl ->
    [true] {" "}and update trait if needed
    *[false] {""}
}
infer_lifetime_param_suggestion_elided = each elided lifetime in input position becomes a distinct lifetime

infer_meant_byte_literal = if you meant to write a byte literal, prefix with `b`
infer_meant_char_literal = if you meant to write a `char` literal, use single quotes
infer_meant_str_literal = if you meant to write a `str` literal, use double quotes
infer_mismatched_static_lifetime = incompatible lifetime on type
infer_more_targeted = {$has_param_name ->
    [true] `{$param_name}`
    *[false] `fn` parameter
} has {$has_lifetime ->
    [true] lifetime `{$lifetime}`
    *[false] an anonymous lifetime `'_`
} but calling `{$ident}` introduces an implicit `'static` lifetime requirement

infer_msl_introduces_static = introduces a `'static` lifetime requirement
infer_msl_trait_note = this has an implicit `'static` lifetime requirement
infer_msl_trait_sugg = consider relaxing the implicit `'static` requirement
infer_msl_unmet_req = because this has an unmet lifetime requirement
infer_need_type_info_in_generator =
    type inside {$generator_kind ->
    [async_block] `async` block
    [async_closure] `async` closure
    [async_fn] `async fn` body
    *[generator] generator
    } must be known in this context


infer_nothing = {""}

infer_oc_cant_coerce = cannot coerce intrinsics to function pointers
infer_oc_closure_selfref = closure/generator type that references itself
infer_oc_const_compat = const not compatible with trait
infer_oc_fn_lang_correct_type = {$lang_item_name ->
        [panic_impl] `#[panic_handler]`
        *[lang_item_name] lang item `{$lang_item_name}`
    } function has wrong type
infer_oc_fn_main_correct_type = `main` function has wrong type
infer_oc_fn_start_correct_type = `#[start]` function has wrong type
infer_oc_generic = mismatched types

infer_oc_if_else_different = `if` and `else` have incompatible types
infer_oc_intrinsic_correct_type = intrinsic has wrong type
infer_oc_match_compat = `match` arms have incompatible types
infer_oc_method_compat = method not compatible with trait
infer_oc_method_correct_type = mismatched `self` parameter type
infer_oc_no_diverge = `else` clause of `let...else` does not diverge
infer_oc_no_else = `if` may be missing an `else` clause
infer_oc_try_compat = `?` operator has incompatible types
infer_oc_type_compat = type not compatible with trait
infer_opaque_captures_lifetime = hidden type for `{$opaque_ty}` captures lifetime that does not appear in bounds
    .label = opaque type defined here

infer_opaque_hidden_type =
    opaque type's hidden type cannot be another opaque type from the same scope
    .label = one of the two opaque types used here has to be outside its defining scope
    .opaque_type = opaque type whose hidden type is being assigned
    .hidden_type = opaque type being used as hidden type

infer_outlives_bound = lifetime of the source pointer does not outlive lifetime bound of the object type
infer_outlives_content = lifetime of reference outlives lifetime of borrowed content...
infer_prlf_defined_with_sub = the lifetime `{$sub_symbol}` defined here...
infer_prlf_defined_without_sub = the lifetime defined here...
infer_prlf_known_limitation = this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)

infer_prlf_must_outlive_with_sup = ...must outlive the lifetime `{$sup_symbol}` defined here
infer_prlf_must_outlive_without_sup = ...must outlive the lifetime defined here
infer_reborrow = ...so that reference does not outlive borrowed content
infer_reborrow_upvar = ...so that closure can access `{$name}`
infer_ref_longer_than_data = in type `{$ty}`, reference has a longer lifetime than the data it references

infer_reference_outlives_referent = ...so that the reference type `{$name}` does not outlive the data it points at
infer_region_explanation = {$pref_kind ->
    *[should_not_happen] [{$pref_kind}]
    [ref_valid_for] ...the reference is valid for
    [content_valid_for] ...but the borrowed content is only valid for
    [type_obj_valid_for] object type is valid for
    [source_pointer_valid_for] source pointer is only valid for
    [type_satisfy] type must satisfy
    [type_outlive] type must outlive
    [lf_param_instantiated_with] lifetime parameter instantiated with
    [lf_param_must_outlive] but lifetime parameter must outlive
    [lf_instantiated_with] lifetime instantiated with
    [lf_must_outlive] but lifetime must outlive
    [pointer_valid_for] the pointer is valid for
    [data_valid_for] but the referenced data is only valid for
    [empty] {""}
}{$pref_kind ->
    [empty] {""}
    *[other] {" "}
}{$desc_kind ->
    *[should_not_happen] [{$desc_kind}]
    [restatic] the static lifetime
    [revar] lifetime {$desc_arg}
    [as_defined] the lifetime `{$desc_arg}` as defined here
    [as_defined_anon] the anonymous lifetime as defined here
    [defined_here] the anonymous lifetime defined here
    [defined_here_reg] the lifetime `{$desc_arg}` as defined here
}{$suff_kind ->
    *[should_not_happen] [{$suff_kind}]
    [empty]{""}
    [continues] ...
    [req_by_binding] {" "}as required by this binding
}

infer_relate_object_bound = ...so that it can be closed over into an object
infer_relate_param_bound = ...so that the type `{$name}` will meet its required lifetime bounds{$continues ->
    [true] ...
    *[false] {""}
}
infer_relate_param_bound_2 = ...that is required by this bound
infer_relate_region_param_bound = ...so that the declared lifetime parameter bounds are satisfied
infer_ril_because_of = because of this returned expression
infer_ril_introduced_by = requirement introduced by this return type
infer_ril_introduced_here = `'static` requirement introduced here
infer_ril_static_introduced_by = "`'static` lifetime requirement introduced by the return type

infer_sbfrit_box_return_expr = if you change the return type to expect trait objects, box the returned expressions

infer_sbfrit_change_return_type = you could change the return type to be a boxed trait object
infer_source_kind_closure_return =
    try giving this closure an explicit return type

# generator_kind  may need to be translated
infer_source_kind_fully_qualified =
    try using a fully qualified path to specify the expected types

infer_source_kind_subdiag_generic_label =
    cannot infer {$is_type ->
    [true] type
    *[false] the value
    } of the {$is_type ->
    [true] type
    *[false] const
    } {$parent_exists ->
    [true] parameter `{$param_name}` declared on the {$parent_prefix} `{$parent_name}`
    *[false] parameter {$param_name}
    }

infer_source_kind_subdiag_generic_suggestion =
    consider specifying the generic {$arg_count ->
    [one] argument
    *[other] arguments
    }

infer_source_kind_subdiag_let = {$kind ->
    [with_pattern] consider giving `{$name}` an explicit type
    [closure] consider giving this closure parameter an explicit type
    *[other] consider giving this pattern a type
}{$x_kind ->
    [has_name] , where the {$prefix_kind ->
        *[type] type for {$prefix}
        [const_with_param] value of const parameter
        [const] value of the constant
    } `{$arg_name}` is specified
    [underscore] , where the placeholders `_` are specified
    *[empty] {""}
}

infer_srs_add = consider returning the local binding `{$ident}`
infer_srs_add_one = consider returning one of these bindings

infer_srs_remove = consider removing this semicolon
infer_srs_remove_and_box = consider removing this semicolon and boxing the expressions
infer_stp_wrap_many = try wrapping the pattern in a variant of `{$path}`

infer_stp_wrap_one = try wrapping the pattern in `{$variant}`
infer_subtype = ...so that the {$requirement ->
    [method_compat] method type is compatible with trait
    [type_compat] associated type is compatible with trait
    [const_compat] const is compatible with trait
    [expr_assignable] expression is assignable
    [if_else_different] `if` and `else` have incompatible types
    [no_else] `if` missing an `else` returns `()`
    [fn_main_correct_type] `main` function has the correct type
    [fn_start_correct_type] `#[start]` function has the correct type
    [fn_lang_correct_type] lang item function has the correct type
    [intrinsic_correct_type] intrinsic has the correct type
    [method_correct_type] method receiver has the correct type
    *[other] types are compatible
}
infer_subtype_2 = ...so that {$requirement ->
    [method_compat] method type is compatible with trait
    [type_compat] associated type is compatible with trait
    [const_compat] const is compatible with trait
    [expr_assignable] expression is assignable
    [if_else_different] `if` and `else` have incompatible types
    [no_else] `if` missing an `else` returns `()`
    [fn_main_correct_type] `main` function has the correct type
    [fn_start_correct_type] `#[start]` function has the correct type
    [fn_lang_correct_type] lang item function has the correct type
    [intrinsic_correct_type] intrinsic has the correct type
    [method_correct_type] method receiver has the correct type
    *[other] types are compatible
}

infer_suggest_accessing_field = you might have meant to use field `{$name}` whose type is `{$ty}`

infer_suggest_add_let_for_letchains = consider adding `let`

infer_tid_consider_borrowing = consider borrowing this type parameter in the trait
infer_tid_param_help = the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`

infer_tid_rel_help = verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
infer_trait_impl_diff = `impl` item signature doesn't match `trait` item signature
    .found = found `{$found}`
    .expected = expected `{$expected}`
    .expected_found = expected signature `{$expected}`
               {"   "}found signature `{$found}`

infer_trait_placeholder_mismatch = implementation of `{$trait_def_id}` is not general enough
    .label_satisfy = doesn't satisfy where-clause
    .label_where = due to a where-clause on `{$def_id}`...
    .label_dup = implementation of `{$trait_def_id}` is not general enough

infer_try_cannot_convert = `?` operator cannot convert from `{$found}` to `{$expected}`

infer_tuple_trailing_comma = use a trailing comma to create a tuple with one element

infer_type_annotations_needed = {$source_kind ->
    [closure] type annotations needed for the closure `{$source_name}`
    [normal] type annotations needed for `{$source_name}`
    *[other] type annotations needed
}
    .label = type must be known at this point

infer_types_declared_different = these two types are declared with different lifetimes...
infer_where_copy_predicates = copy the `where` clause predicates from the trait

infer_where_remove = remove the `where` clause