Rollup merge of #102786 - compiler-errors:no-tuple-candidate, r=lcnr
Remove tuple candidate, nothing special about it r? `@lcnr` you mentioned this during the talk you gave i think
This commit is contained in:
commit
58d533dfc1
@ -664,10 +664,6 @@ pub enum ImplSource<'tcx, N> {
|
|||||||
|
|
||||||
/// ImplSource for a `const Drop` implementation.
|
/// ImplSource for a `const Drop` implementation.
|
||||||
ConstDestruct(ImplSourceConstDestructData<N>),
|
ConstDestruct(ImplSourceConstDestructData<N>),
|
||||||
|
|
||||||
/// ImplSource for a `std::marker::Tuple` implementation.
|
|
||||||
/// This has no nested predicates ever, so no data.
|
|
||||||
Tuple,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, N> ImplSource<'tcx, N> {
|
impl<'tcx, N> ImplSource<'tcx, N> {
|
||||||
@ -682,8 +678,7 @@ impl<'tcx, N> ImplSource<'tcx, N> {
|
|||||||
ImplSource::Object(d) => d.nested,
|
ImplSource::Object(d) => d.nested,
|
||||||
ImplSource::FnPointer(d) => d.nested,
|
ImplSource::FnPointer(d) => d.nested,
|
||||||
ImplSource::DiscriminantKind(ImplSourceDiscriminantKindData)
|
ImplSource::DiscriminantKind(ImplSourceDiscriminantKindData)
|
||||||
| ImplSource::Pointee(ImplSourcePointeeData)
|
| ImplSource::Pointee(ImplSourcePointeeData) => vec![],
|
||||||
| ImplSource::Tuple => Vec::new(),
|
|
||||||
ImplSource::TraitAlias(d) => d.nested,
|
ImplSource::TraitAlias(d) => d.nested,
|
||||||
ImplSource::TraitUpcasting(d) => d.nested,
|
ImplSource::TraitUpcasting(d) => d.nested,
|
||||||
ImplSource::ConstDestruct(i) => i.nested,
|
ImplSource::ConstDestruct(i) => i.nested,
|
||||||
@ -701,8 +696,7 @@ impl<'tcx, N> ImplSource<'tcx, N> {
|
|||||||
ImplSource::Object(d) => &d.nested,
|
ImplSource::Object(d) => &d.nested,
|
||||||
ImplSource::FnPointer(d) => &d.nested,
|
ImplSource::FnPointer(d) => &d.nested,
|
||||||
ImplSource::DiscriminantKind(ImplSourceDiscriminantKindData)
|
ImplSource::DiscriminantKind(ImplSourceDiscriminantKindData)
|
||||||
| ImplSource::Pointee(ImplSourcePointeeData)
|
| ImplSource::Pointee(ImplSourcePointeeData) => &[],
|
||||||
| ImplSource::Tuple => &[],
|
|
||||||
ImplSource::TraitAlias(d) => &d.nested,
|
ImplSource::TraitAlias(d) => &d.nested,
|
||||||
ImplSource::TraitUpcasting(d) => &d.nested,
|
ImplSource::TraitUpcasting(d) => &d.nested,
|
||||||
ImplSource::ConstDestruct(i) => &i.nested,
|
ImplSource::ConstDestruct(i) => &i.nested,
|
||||||
@ -769,7 +763,6 @@ impl<'tcx, N> ImplSource<'tcx, N> {
|
|||||||
nested: i.nested.into_iter().map(f).collect(),
|
nested: i.nested.into_iter().map(f).collect(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ImplSource::Tuple => ImplSource::Tuple,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,9 +161,6 @@ pub enum SelectionCandidate<'tcx> {
|
|||||||
|
|
||||||
/// Implementation of `const Destruct`, optionally from a custom `impl const Drop`.
|
/// Implementation of `const Destruct`, optionally from a custom `impl const Drop`.
|
||||||
ConstDestructCandidate(Option<DefId>),
|
ConstDestructCandidate(Option<DefId>),
|
||||||
|
|
||||||
/// Witnesses the fact that a type is a tuple.
|
|
||||||
TupleCandidate,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The result of trait evaluation. The order is important
|
/// The result of trait evaluation. The order is important
|
||||||
|
@ -34,8 +34,6 @@ impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSource<'tcx, N> {
|
|||||||
super::ImplSource::TraitUpcasting(ref d) => write!(f, "{:?}", d),
|
super::ImplSource::TraitUpcasting(ref d) => write!(f, "{:?}", d),
|
||||||
|
|
||||||
super::ImplSource::ConstDestruct(ref d) => write!(f, "{:?}", d),
|
super::ImplSource::ConstDestruct(ref d) => write!(f, "{:?}", d),
|
||||||
|
|
||||||
super::ImplSource::Tuple => write!(f, "ImplSource::Tuple"),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1750,8 +1750,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
|
|||||||
super::ImplSource::AutoImpl(..)
|
super::ImplSource::AutoImpl(..)
|
||||||
| super::ImplSource::Builtin(..)
|
| super::ImplSource::Builtin(..)
|
||||||
| super::ImplSource::TraitUpcasting(_)
|
| super::ImplSource::TraitUpcasting(_)
|
||||||
| super::ImplSource::ConstDestruct(_)
|
| super::ImplSource::ConstDestruct(_) => {
|
||||||
| super::ImplSource::Tuple => {
|
|
||||||
// These traits have no associated types.
|
// These traits have no associated types.
|
||||||
selcx.tcx().sess.delay_span_bug(
|
selcx.tcx().sess.delay_span_bug(
|
||||||
obligation.cause.span,
|
obligation.cause.span,
|
||||||
@ -1829,8 +1828,7 @@ fn confirm_select_candidate<'cx, 'tcx>(
|
|||||||
| super::ImplSource::Builtin(..)
|
| super::ImplSource::Builtin(..)
|
||||||
| super::ImplSource::TraitUpcasting(_)
|
| super::ImplSource::TraitUpcasting(_)
|
||||||
| super::ImplSource::TraitAlias(..)
|
| super::ImplSource::TraitAlias(..)
|
||||||
| super::ImplSource::ConstDestruct(_)
|
| super::ImplSource::ConstDestruct(_) => {
|
||||||
| super::ImplSource::Tuple => {
|
|
||||||
// we don't create Select candidates with this kind of resolution
|
// we don't create Select candidates with this kind of resolution
|
||||||
span_bug!(
|
span_bug!(
|
||||||
obligation.cause.span,
|
obligation.cause.span,
|
||||||
|
@ -1021,7 +1021,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
let self_ty = self.infcx().shallow_resolve(obligation.self_ty().skip_binder());
|
let self_ty = self.infcx().shallow_resolve(obligation.self_ty().skip_binder());
|
||||||
match self_ty.kind() {
|
match self_ty.kind() {
|
||||||
ty::Tuple(_) => {
|
ty::Tuple(_) => {
|
||||||
candidates.vec.push(TupleCandidate);
|
candidates.vec.push(BuiltinCandidate { has_nested: false });
|
||||||
}
|
}
|
||||||
ty::Infer(ty::TyVar(_)) => {
|
ty::Infer(ty::TyVar(_)) => {
|
||||||
candidates.ambiguous = true;
|
candidates.ambiguous = true;
|
||||||
|
@ -126,8 +126,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
let data = self.confirm_const_destruct_candidate(obligation, def_id)?;
|
let data = self.confirm_const_destruct_candidate(obligation, def_id)?;
|
||||||
ImplSource::ConstDestruct(data)
|
ImplSource::ConstDestruct(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
TupleCandidate => ImplSource::Tuple,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if !obligation.predicate.is_const_if_const() {
|
if !obligation.predicate.is_const_if_const() {
|
||||||
|
@ -1562,7 +1562,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// (*) Prefer `BuiltinCandidate { has_nested: false }`, `PointeeCandidate`,
|
// (*) Prefer `BuiltinCandidate { has_nested: false }`, `PointeeCandidate`,
|
||||||
// `DiscriminantKindCandidate`, `ConstDestructCandidate`, and `TupleCandidate`
|
// `DiscriminantKindCandidate`, `ConstDestructCandidate`
|
||||||
// to anything else.
|
// to anything else.
|
||||||
//
|
//
|
||||||
// This is a fix for #53123 and prevents winnowing from accidentally extending the
|
// This is a fix for #53123 and prevents winnowing from accidentally extending the
|
||||||
@ -1583,8 +1583,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
BuiltinCandidate { has_nested: false }
|
BuiltinCandidate { has_nested: false }
|
||||||
| DiscriminantKindCandidate
|
| DiscriminantKindCandidate
|
||||||
| PointeeCandidate
|
| PointeeCandidate
|
||||||
| ConstDestructCandidate(_)
|
| ConstDestructCandidate(_),
|
||||||
| TupleCandidate,
|
|
||||||
_,
|
_,
|
||||||
) => true,
|
) => true,
|
||||||
(
|
(
|
||||||
@ -1592,8 +1591,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
BuiltinCandidate { has_nested: false }
|
BuiltinCandidate { has_nested: false }
|
||||||
| DiscriminantKindCandidate
|
| DiscriminantKindCandidate
|
||||||
| PointeeCandidate
|
| PointeeCandidate
|
||||||
| ConstDestructCandidate(_)
|
| ConstDestructCandidate(_),
|
||||||
| TupleCandidate,
|
|
||||||
) => false,
|
) => false,
|
||||||
|
|
||||||
(ParamCandidate(other), ParamCandidate(victim)) => {
|
(ParamCandidate(other), ParamCandidate(victim)) => {
|
||||||
|
@ -267,8 +267,7 @@ fn resolve_associated_item<'tcx>(
|
|||||||
| traits::ImplSource::DiscriminantKind(..)
|
| traits::ImplSource::DiscriminantKind(..)
|
||||||
| traits::ImplSource::Pointee(..)
|
| traits::ImplSource::Pointee(..)
|
||||||
| traits::ImplSource::TraitUpcasting(_)
|
| traits::ImplSource::TraitUpcasting(_)
|
||||||
| traits::ImplSource::ConstDestruct(_)
|
| traits::ImplSource::ConstDestruct(_) => None,
|
||||||
| traits::ImplSource::Tuple => None,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user