Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 970ee09

Browse files
Rollup merge of #115879 - clubby789:migrate-hir-typeck-cast, r=compiler-errors
Migrate diagnostics in `hir_typeck/src/cast.rs`
2 parents 48c6051 + 9c5de75 commit 970ee09

File tree

9 files changed

+363
-192
lines changed

9 files changed

+363
-192
lines changed

‎compiler/rustc_hir_typeck/messages.ftl‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ hir_typeck_candidate_trait_note = `{$trait_name}` defines an item `{$item_name}`
1616
*[other] , perhaps you need to restrict type parameter `{$action_or_ty}` with it
1717
}
1818
19+
hir_typeck_cannot_cast_to_bool = cannot cast `{$expr_ty}` as `bool`
20+
.suggestion = compare with zero instead
21+
.help = compare with zero instead
22+
.label = unsupported cast
23+
24+
hir_typeck_cast_enum_drop = cannot cast enum `{$expr_ty}` into integer `{$cast_ty}` because it implements `Drop`
25+
26+
hir_typeck_cast_unknown_pointer = cannot cast {$to ->
27+
[true] to
28+
*[false] from
29+
} a pointer of an unknown kind
30+
.label_to = needs more type information
31+
.note = the type information given here is insufficient to check whether the pointer cast is valid
32+
.label_from = the type information given here is insufficient to check whether the pointer cast is valid
33+
1934
hir_typeck_const_select_must_be_const = this argument must be a `const fn`
2035
.help = consult the documentation on `const_eval_select` for more information
2136
@@ -29,6 +44,8 @@ hir_typeck_convert_using_method = try using `{$sugg}` to convert `{$found}` to `
2944
3045
hir_typeck_ctor_is_private = tuple struct constructor `{$def}` is private
3146
47+
hir_typeck_deref_is_empty = this expression `Deref`s to `{$deref_ty}` which implements `is_empty`
48+
3249
hir_typeck_expected_default_return_type = expected `()` because of default return type
3350
3451
hir_typeck_expected_return_type = expected `{$expected}` because of return type
@@ -57,6 +74,13 @@ hir_typeck_functional_record_update_on_non_struct =
5774
hir_typeck_help_set_edition_cargo = set `edition = "{$edition}"` in `Cargo.toml`
5875
hir_typeck_help_set_edition_standalone = pass `--edition {$edition}` to `rustc`
5976
77+
hir_typeck_int_to_fat = cannot cast `{$expr_ty}` to a pointer that {$known_wide ->
78+
[true] is
79+
*[false] may be
80+
} wide
81+
hir_typeck_int_to_fat_label = creating a `{$cast_ty}` requires both an address and {$metadata}
82+
hir_typeck_int_to_fat_label_nightly = consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts`
83+
6084
hir_typeck_invalid_callee = expected function, found {$ty}
6185
6286
hir_typeck_lang_start_expected_sig_note = the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
@@ -69,6 +93,16 @@ hir_typeck_lang_start_incorrect_param = parameter {$param_num} of the `start` la
6993
hir_typeck_lang_start_incorrect_ret_ty = the return type of the `start` lang item is incorrect
7094
.suggestion = change the type from `{$found_ty}` to `{$expected_ty}`
7195
96+
hir_typeck_lossy_provenance_int2ptr =
97+
strict provenance disallows casting integer `{$expr_ty}` to pointer `{$cast_ty}`
98+
.suggestion = use `.with_addr()` to adjust a valid pointer in the same allocation, to this address
99+
.help = if you can't comply with strict provenance and don't have a pointer with the correct provenance you can use `std::ptr::from_exposed_addr()` instead
100+
101+
hir_typeck_lossy_provenance_ptr2int =
102+
under strict provenance it is considered bad style to cast pointer `{$expr_ty}` to integer `{$cast_ty}`
103+
.suggestion = use `.addr()` to obtain the address of a pointer
104+
.help = if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead
105+
72106
hir_typeck_method_call_on_unknown_raw_pointee =
73107
cannot call a method on a raw pointer with an unknown pointee type
74108
@@ -113,8 +147,18 @@ hir_typeck_suggest_boxing_when_appropriate = store this in the heap by calling `
113147
114148
hir_typeck_suggest_ptr_null_mut = consider using `core::ptr::null_mut` instead
115149
150+
hir_typeck_trivial_cast = trivial {$numeric ->
151+
[true] numeric cast
152+
*[false] cast
153+
}: `{$expr_ty}` as `{$cast_ty}`
154+
.help = cast can be replaced by coercion; this might require a temporary variable
155+
116156
hir_typeck_union_pat_dotdot = `..` cannot be used in union patterns
117157
118158
hir_typeck_union_pat_multiple_fields = union patterns should have exactly one field
159+
160+
hir_typeck_use_is_empty =
161+
consider using the `is_empty` method on `{$expr_ty}` to determine if it contains anything
162+
119163
hir_typeck_yield_expr_outside_of_generator =
120164
yield expression outside of generator literal

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /