// const param
ParamCandidate(trait_pred) if trait_pred.is_const_if_const() => {}
// const projection
- ProjectionCandidate(_, ty::BoundConstness::ConstIfConst) => {}
+ ProjectionCandidate(_, ty::BoundConstness::ConstIfConst)
// auto trait impl
- AutoImplCandidate => {}
+ | AutoImplCandidate
// generator / future, this will raise error in other places
// or ignore error with const_async_blocks feature
- GeneratorCandidate => {}
- FutureCandidate => {}
+ | GeneratorCandidate
+ | FutureCandidate
// FnDef where the function is const
- FnPointerCandidate { is_const: true } => {}
+ | FnPointerCandidate { is_const: true }
+ | ConstDestructCandidate(_)
+ | ClosureCandidate { is_const: true } => {}
+
FnPointerCandidate { is_const: false } => {
if let ty::FnDef(def_id, _) = obligation.self_ty().skip_binder().kind() && tcx.trait_of_item(*def_id).is_some() {
// Trait methods are not seen as const unless the trait is implemented as const.
continue
}
}
- ConstDestructCandidate(_) => {}
+
_ => {
// reject all other types of candidates
continue;
(
ParamCandidate(ref cand),
ImplCandidate(..)
- | ClosureCandidate
+ | ClosureCandidate { .. }
| GeneratorCandidate
| FutureCandidate
| FnPointerCandidate { .. }
}
(
ImplCandidate(_)
- | ClosureCandidate
+ | ClosureCandidate { .. }
| GeneratorCandidate
| FutureCandidate
| FnPointerCandidate { .. }
(
ObjectCandidate(_) | ProjectionCandidate(..),
ImplCandidate(..)
- | ClosureCandidate
+ | ClosureCandidate { .. }
| GeneratorCandidate
| FutureCandidate
| FnPointerCandidate { .. }
(
ImplCandidate(..)
- | ClosureCandidate
+ | ClosureCandidate { .. }
| GeneratorCandidate
| FutureCandidate
| FnPointerCandidate { .. }
// Everything else is ambiguous
(
ImplCandidate(_)
- | ClosureCandidate
+ | ClosureCandidate { .. }
| GeneratorCandidate
| FutureCandidate
| FnPointerCandidate { .. }
| BuiltinCandidate { has_nested: true }
| TraitAliasCandidate,
ImplCandidate(_)
- | ClosureCandidate
+ | ClosureCandidate { .. }
| GeneratorCandidate
| FutureCandidate
| FnPointerCandidate { .. }