Skip to content

Commit 88fb1b9

Browse files
committed
Auto merge of #108698 - IntQuant:issue-100717-infer-6, r=davidtwco
Migrating rustc_infer to session diagnostics (part 5) `@rustbot` label +A-translation cc #100717
2 parents a732883 + d07b1cd commit 88fb1b9

File tree

6 files changed

+767
-356
lines changed

6 files changed

+767
-356
lines changed

Diff for: compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
768768
let (provided_ty, provided_span) = provided_arg_tys[*provided_idx];
769769
let trace =
770770
mk_trace(provided_span, formal_and_expected_inputs[*expected_idx], provided_ty);
771-
if !matches!(trace.cause.as_failure_code(*e), FailureCode::Error0308(_)) {
771+
if !matches!(trace.cause.as_failure_code(*e), FailureCode::Error0308) {
772772
self.err_ctxt().report_and_explain_type_error(trace, *e).emit();
773773
return true;
774774
}

Diff for: compiler/rustc_infer/messages.ftl

+44
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,47 @@ infer_prlf_known_limitation = this is a known limitation that will be removed in
348348
349349
infer_opaque_captures_lifetime = hidden type for `{$opaque_ty}` captures lifetime that does not appear in bounds
350350
.label = opaque type defined here
351+
352+
infer_fps_use_ref = consider using a reference
353+
infer_fps_remove_ref = consider removing the reference
354+
infer_fps_cast = consider casting to a fn pointer
355+
infer_fps_items_are_distinct = fn items are distinct from fn pointers
356+
infer_fps_cast_both = consider casting both fn items to fn pointers using `as {$expected_sig}`
357+
358+
infer_fn_uniq_types = different fn items have unique types, even if their signatures are the same
359+
infer_fn_consider_casting = consider casting the fn item to a fn pointer: `{$casting}`
360+
361+
infer_sarwa_option = you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`
362+
infer_sarwa_result = you can convert from `&Result<T, E>` to `Result<&T, &E>` using `.as_ref()`
363+
364+
infer_suggest_accessing_field = you might have meant to use field `{$name}` whose type is `{$ty}`
365+
366+
infer_sbfrit_change_return_type = you could change the return type to be a boxed trait object
367+
infer_sbfrit_box_return_expr = if you change the return type to expect trait objects, box the returned expressions
368+
369+
infer_stp_wrap_one = try wrapping the pattern in `{$variant}`
370+
infer_stp_wrap_many = try wrapping the pattern in a variant of `{$path}`
371+
372+
infer_tuple_trailing_comma = use a trailing comma to create a tuple with one element
373+
374+
infer_oc_method_compat = method not compatible with trait
375+
infer_oc_type_compat = type not compatible with trait
376+
infer_oc_const_compat = const not compatible with trait
377+
infer_oc_try_compat = `?` operator has incompatible types
378+
infer_oc_match_compat = `match` arms have incompatible types
379+
infer_oc_if_else_different = `if` and `else` have incompatible types
380+
infer_oc_no_else = `if` may be missing an `else` clause
381+
infer_oc_no_diverge = `else` clause of `let...else` does not diverge
382+
infer_oc_fn_main_correct_type = `main` function has wrong type
383+
infer_oc_fn_start_correct_type = `#[start]` function has wrong type
384+
infer_oc_intristic_correct_type = intrinsic has wrong type
385+
infer_oc_method_correct_type = mismatched `self` parameter type
386+
infer_oc_closure_selfref = closure/generator type that references itself
387+
infer_oc_cant_coerce = cannot coerce intrinsics to function pointers
388+
infer_oc_generic = mismatched types
389+
390+
infer_meant_byte_literal = if you meant to write a byte literal, prefix with `b`
391+
infer_meant_char_literal = if you meant to write a `char` literal, use single quotes
392+
infer_meant_str_literal = if you meant to write a `str` literal, use double quotes
393+
infer_consider_specifying_length = consider specifying the actual array length
394+
infer_try_cannot_convert = `?` operator cannot convert from `{$found}` to `{$expected}`

0 commit comments

Comments
 (0)