/// parameter environment.
#[derive(PartialEq,Eq,Debug,Clone)]
enum SelectionCandidate<'tcx> {
+ /// If has_nested is false, there are no *further* obligations
BuiltinCandidate { has_nested: bool },
ParamCandidate(ty::PolyTraitRef<'tcx>),
ImplCandidate(DefId),
}
match other.candidate {
+ // Prefer BuiltinCandidate { has_nested: false } to anything else.
+ // This is a fix for #53123 and prevents winnowing from accidentally extending the
+ // lifetime of a variable.
+ BuiltinCandidate { has_nested: false } => true,
ParamCandidate(ref cand) => match victim.candidate {
AutoImplCandidate(..) => {
bug!(
"default implementations shouldn't be recorded \
when there are other valid candidates");
}
+ // Prefer BuiltinCandidate { has_nested: false } to anything else.
+ // This is a fix for #53123 and prevents winnowing from accidentally extending the
+ // lifetime of a variable.
+ BuiltinCandidate { has_nested: false } => false,
ImplCandidate(..) |
ClosureCandidate |
GeneratorCandidate |
"default implementations shouldn't be recorded \
when there are other valid candidates");
}
+ // Prefer BuiltinCandidate { has_nested: false } to anything else.
+ // This is a fix for #53123 and prevents winnowing from accidentally extending the
+ // lifetime of a variable.
+ BuiltinCandidate { has_nested: false } => false,
ImplCandidate(..) |
ClosureCandidate |
GeneratorCandidate |
FnPointerCandidate |
BuiltinObjectCandidate |
BuiltinUnsizeCandidate |
- BuiltinCandidate { .. } => {
+ BuiltinCandidate { has_nested: true } => {
match victim.candidate {
ParamCandidate(ref cand) => {
// Prefer these to a global where-clause bound