remove unnecessary variant

This commit is contained in:
lcnr 2025-03-12 10:12:02 +01:00
parent a21d9789e2
commit adbcb910f0
3 changed files with 6 additions and 11 deletions

View file

@ -980,12 +980,9 @@ pub enum CodegenObligationError {
/// overflow bug, since I believe this is the only case /// overflow bug, since I believe this is the only case
/// where ambiguity can result. /// where ambiguity can result.
Ambiguity, Ambiguity,
/// This can trigger when we probe for the source of a `'static` lifetime requirement /// This can trigger when we have a global bound that is not actually satisfied
/// on a trait object: `impl Foo for dyn Trait {}` has an implicit `'static` bound. /// due to trivial bounds.
/// This can also trigger when we have a global bound that is not actually satisfied,
/// but was included during typeck due to the trivial_bounds feature.
Unimplemented, Unimplemented,
FulfillmentError,
/// The selected impl has unconstrained generic parameters. This will emit an error /// The selected impl has unconstrained generic parameters. This will emit an error
/// during impl WF checking. /// during impl WF checking.
UnconstrainedParam(ErrorGuaranteed), UnconstrainedParam(ErrorGuaranteed),

View file

@ -70,7 +70,7 @@ pub(crate) fn codegen_select_candidate<'tcx>(
infcx.err_ctxt().report_overflow_obligation_cycle(&cycle); infcx.err_ctxt().report_overflow_obligation_cycle(&cycle);
} }
} }
return Err(CodegenObligationError::FulfillmentError); return Err(CodegenObligationError::Unimplemented);
} }
let impl_source = infcx.resolve_vars_if_possible(impl_source); let impl_source = infcx.resolve_vars_if_possible(impl_source);

View file

@ -107,11 +107,9 @@ fn resolve_associated_item<'tcx>(
let input = typing_env.as_query_input(trait_ref); let input = typing_env.as_query_input(trait_ref);
let vtbl = match tcx.codegen_select_candidate(input) { let vtbl = match tcx.codegen_select_candidate(input) {
Ok(vtbl) => vtbl, Ok(vtbl) => vtbl,
Err( Err(CodegenObligationError::Ambiguity | CodegenObligationError::Unimplemented) => {
CodegenObligationError::Ambiguity return Ok(None);
| CodegenObligationError::Unimplemented }
| CodegenObligationError::FulfillmentError,
) => return Ok(None),
Err(CodegenObligationError::UnconstrainedParam(guar)) => return Err(guar), Err(CodegenObligationError::UnconstrainedParam(guar)) => return Err(guar),
}; };