Argument { bb: BasicBlock, index: usize },
}
+impl Candidate {
+ /// Returns `true` if we should use the "explicit" rules for promotability for this `Candidate`.
+ fn forces_explicit_promotion(&self) -> bool {
+ match self {
+ Candidate::Ref(_) |
+ Candidate::Repeat(_) => false,
+ Candidate::Argument { .. } => true,
+ }
+ }
+}
+
fn args_required_const(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Vec<usize>> {
let attrs = tcx.get_attrs(def_id);
let attr = attrs.iter().find(|a| a.check_name(sym::rustc_args_required_const))?;
};
candidates.iter().copied().filter(|&candidate| {
- validator.explicit = match candidate {
- Candidate::Ref(_) |
- Candidate::Repeat(_) => false,
- Candidate::Argument { .. } => true,
- };
+ validator.explicit = candidate.forces_explicit_promotion();
// FIXME(eddyb) also emit the errors for shuffle indices
// and `#[rustc_args_required_const]` arguments here.