pub fn intercrate_ambiguity_hint(&self) -> String {
match self {
- &IntercrateAmbiguityCause::DownstreamCrate { ref trait_desc, ref self_desc } => {
- let self_desc = if let &Some(ref ty) = self_desc {
+ IntercrateAmbiguityCause::DownstreamCrate { trait_desc, self_desc } => {
+ let self_desc = if let Some(ty) = self_desc {
format!(" for type `{}`", ty)
} else {
String::new()
};
format!("downstream crates may implement trait `{}`{}", trait_desc, self_desc)
}
- &IntercrateAmbiguityCause::UpstreamCrateUpdate { ref trait_desc, ref self_desc } => {
- let self_desc = if let &Some(ref ty) = self_desc {
+ IntercrateAmbiguityCause::UpstreamCrateUpdate { trait_desc, self_desc } => {
+ let self_desc = if let Some(ty) = self_desc {
format!(" for type `{}`", ty)
} else {
String::new()
trait_desc, self_desc
)
}
- &IntercrateAmbiguityCause::ReservationImpl { ref message } => message.clone(),
+ IntercrateAmbiguityCause::ReservationImpl { message } => message.clone(),
}
}
}
}
let result = ensure_sufficient_stack(|| {
- let bound_predicate = obligation.predicate.bound_atom();
+ let bound_predicate = obligation.predicate.kind();
match bound_predicate.skip_binder() {
- ty::PredicateAtom::Trait(t, _) => {
+ ty::PredicateKind::Trait(t, _) => {
let t = bound_predicate.rebind(t);
debug_assert!(!t.has_escaping_bound_vars());
let obligation = obligation.with(t);
self.evaluate_trait_predicate_recursively(previous_stack, obligation)
}
- ty::PredicateAtom::Subtype(p) => {
+ ty::PredicateKind::Subtype(p) => {
let p = bound_predicate.rebind(p);
// Does this code ever run?
match self.infcx.subtype_predicate(&obligation.cause, obligation.param_env, p) {
}
}
- ty::PredicateAtom::WellFormed(arg) => match wf::obligations(
+ ty::PredicateKind::WellFormed(arg) => match wf::obligations(
self.infcx,
obligation.param_env,
obligation.cause.body_id,
None => Ok(EvaluatedToAmbig),
},
- ty::PredicateAtom::TypeOutlives(..) | ty::PredicateAtom::RegionOutlives(..) => {
+ ty::PredicateKind::TypeOutlives(..) | ty::PredicateKind::RegionOutlives(..) => {
// We do not consider region relationships when evaluating trait matches.
Ok(EvaluatedToOkModuloRegions)
}
- ty::PredicateAtom::ObjectSafe(trait_def_id) => {
+ ty::PredicateKind::ObjectSafe(trait_def_id) => {
if self.tcx().is_object_safe(trait_def_id) {
Ok(EvaluatedToOk)
} else {
}
}
- ty::PredicateAtom::Projection(data) => {
+ ty::PredicateKind::Projection(data) => {
let data = bound_predicate.rebind(data);
let project_obligation = obligation.with(data);
match project::poly_project_and_unify_type(self, &project_obligation) {
}
}
- ty::PredicateAtom::ClosureKind(_, closure_substs, kind) => {
+ ty::PredicateKind::ClosureKind(_, closure_substs, kind) => {
match self.infcx.closure_kind(closure_substs) {
Some(closure_kind) => {
if closure_kind.extends(kind) {
}
}
- ty::PredicateAtom::ConstEvaluatable(def_id, substs) => {
+ ty::PredicateKind::ConstEvaluatable(def_id, substs) => {
match const_evaluatable::is_const_evaluatable(
self.infcx,
def_id,
}
}
- ty::PredicateAtom::ConstEquate(c1, c2) => {
+ ty::PredicateKind::ConstEquate(c1, c2) => {
debug!(?c1, ?c2, "evaluate_predicate_recursively: equating consts");
let evaluate = |c: &'tcx ty::Const<'tcx>| {
}
}
}
- ty::PredicateAtom::TypeWellFormedFromEnv(..) => {
+ ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for chalk")
}
}
}
fn coinductive_predicate(&self, predicate: ty::Predicate<'tcx>) -> bool {
- let result = match predicate.skip_binders() {
- ty::PredicateAtom::Trait(ref data, _) => self.tcx().trait_is_auto(data.def_id()),
+ let result = match predicate.kind().skip_binder() {
+ ty::PredicateKind::Trait(ref data, _) => self.tcx().trait_is_auto(data.def_id()),
_ => false,
};
debug!(?predicate, ?result, "coinductive_predicate");
.iter()
.enumerate()
.filter_map(|(idx, bound)| {
- let bound_predicate = bound.bound_atom();
- if let ty::PredicateAtom::Trait(pred, _) = bound_predicate.skip_binder() {
+ let bound_predicate = bound.kind();
+ if let ty::PredicateKind::Trait(pred, _) = bound_predicate.skip_binder() {
let bound = bound_predicate.rebind(pred.trait_ref);
if self.infcx.probe(|_| {
match self.match_normalize_trait_ref(