use crate::traits::ProjectionCacheKey;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::stack::ensure_sufficient_stack;
-use rustc_errors::ErrorReported;
+use rustc_errors::{Diagnostic, ErrorReported};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_infer::infer::LateBoundRegionConversionTime;
impl IntercrateAmbiguityCause {
/// Emits notes when the overlap is caused by complex intercrate ambiguities.
/// See #23980 for details.
- pub fn add_intercrate_ambiguity_hint(&self, err: &mut rustc_errors::DiagnosticBuilder<'_>) {
+ pub fn add_intercrate_ambiguity_hint(&self, err: &mut Diagnostic) {
err.note(&self.intercrate_ambiguity_hint());
}
if !candidate_set.ambiguous && candidate_set.vec.is_empty() {
let trait_ref = stack.obligation.predicate.skip_binder().trait_ref;
let self_ty = trait_ref.self_ty();
- let cause = with_no_trimmed_paths(|| {
+ let cause = with_no_trimmed_paths!({
IntercrateAmbiguityCause::DownstreamCrate {
trait_desc: trait_ref.print_only_trait_path().to_string(),
self_desc: if self_ty.has_concrete_skeleton() {
.map_err(|_| ())
}
- fn evaluate_where_clause<'o>(
+ fn where_clause_may_apply<'o>(
&mut self,
stack: &TraitObligationStack<'o, 'tcx>,
where_clause_trait_ref: ty::PolyTraitRef<'tcx>,
ty::Str | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => None,
ty::Tuple(tys) => Where(
- obligation
- .predicate
- .rebind(tys.last().into_iter().map(|k| k.expect_ty()).collect()),
+ obligation.predicate.rebind(tys.last().map_or_else(Vec::new, |&last| vec![last])),
),
ty::Adt(def, substs) => {
ty::Tuple(tys) => {
// (*) binder moved here
- Where(obligation.predicate.rebind(tys.iter().map(|k| k.expect_ty()).collect()))
+ Where(obligation.predicate.rebind(tys.iter().collect()))
}
ty::Closure(_, substs) => {
ty::Tuple(ref tys) => {
// (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
- t.rebind(tys.iter().map(|k| k.expect_ty()).collect())
+ t.rebind(tys.iter().collect())
}
ty::Closure(_, ref substs) => {