NonGenericOpaqueTypeParam::ty to arg

This commit is contained in:
lcnr 2025-04-11 12:04:48 +02:00
parent 83033838a3
commit 5d0048303c
3 changed files with 4 additions and 4 deletions

View file

@ -268,8 +268,8 @@ trait_selection_oc_type_compat = type not compatible with trait
trait_selection_opaque_captures_lifetime = hidden type for `{$opaque_ty}` captures lifetime that does not appear in bounds
.label = opaque type defined here
trait_selection_opaque_type_non_generic_param =
expected generic {$kind} parameter, found `{$ty}`
.label = {STREQ($ty, "'static") ->
expected generic {$kind} parameter, found `{$arg}`
.label = {STREQ($arg, "'static") ->
[true] cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type
*[other] this generic parameter must be used with a generic {$kind} parameter
}

View file

@ -1926,7 +1926,7 @@ impl Subdiagnostic for AddPreciseCapturingForOvercapture {
#[derive(Diagnostic)]
#[diag(trait_selection_opaque_type_non_generic_param, code = E0792)]
pub(crate) struct NonGenericOpaqueTypeParam<'a, 'tcx> {
pub ty: GenericArg<'tcx>,
pub arg: GenericArg<'tcx>,
pub kind: &'a str,
#[primary_span]
pub span: Span,

View file

@ -70,7 +70,7 @@ pub fn check_opaque_type_parameter_valid<'tcx>(
opaque_env.param_is_error(i)?;
return Err(infcx.dcx().emit_err(NonGenericOpaqueTypeParam {
ty: arg,
arg,
kind,
span,
param_span: tcx.def_span(opaque_param.def_id),