Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating rustc_infer to session diagnostics (part 5) #108698

Merged
merged 16 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let (provided_ty, provided_span) = provided_arg_tys[*provided_idx];
let trace =
mk_trace(provided_span, formal_and_expected_inputs[*expected_idx], provided_ty);
if !matches!(trace.cause.as_failure_code(*e), FailureCode::Error0308(_)) {
if !matches!(trace.cause.as_failure_code(*e), FailureCode::Error0308) {
self.err_ctxt().report_and_explain_type_error(trace, *e).emit();
return true;
}
Expand Down
44 changes: 44 additions & 0 deletions compiler/rustc_infer/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,47 @@ infer_prlf_known_limitation = this is a known limitation that will be removed in

infer_opaque_captures_lifetime = hidden type for `{$opaque_ty}` captures lifetime that does not appear in bounds
.label = opaque type defined here

infer_fps_use_ref = consider using a reference
infer_fps_remove_ref = consider removing the reference
infer_fps_cast = consider casting to a fn pointer
infer_fps_items_are_distinct = fn items are distinct from fn pointers
infer_fps_cast_both = consider casting both fn items to fn pointers using `as {$expected_sig}`

infer_fn_uniq_types = different fn items have unique types, even if their signatures are the same
infer_fn_consider_casting = consider casting the fn item to a fn pointer: `{$casting}`

infer_sarwa_option = you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`
infer_sarwa_result = you can convert from `&Result<T, E>` to `Result<&T, &E>` using `.as_ref()`

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

infer_sbfrit_change_return_type = you could change the return type to be a boxed trait object
infer_sbfrit_box_return_expr = if you change the return type to expect trait objects, box the returned expressions

infer_stp_wrap_one = try wrapping the pattern in `{$variant}`
infer_stp_wrap_many = try wrapping the pattern in a variant of `{$path}`

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

infer_oc_method_compat = method not compatible with trait
infer_oc_type_compat = type not compatible with trait
infer_oc_const_compat = const not compatible with trait
infer_oc_try_compat = `?` operator has incompatible types
infer_oc_match_compat = `match` arms have incompatible types
infer_oc_if_else_different = `if` and `else` have incompatible types
infer_oc_no_else = `if` may be missing an `else` clause
infer_oc_no_diverge = `else` clause of `let...else` does not diverge
infer_oc_fn_main_correct_type = `main` function has wrong type
infer_oc_fn_start_correct_type = `#[start]` function has wrong type
infer_oc_intristic_correct_type = intrinsic has wrong type
infer_oc_method_correct_type = mismatched `self` parameter type
infer_oc_closure_selfref = closure/generator type that references itself
infer_oc_cant_coerce = cannot coerce intrinsics to function pointers
infer_oc_generic = mismatched types

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_consider_specifying_length = consider specifying the actual array length
infer_try_cannot_convert = `?` operator cannot convert from `{$found}` to `{$expected}`
Loading