Rustfmt
This commit is contained in:
parent
3183b44a1e
commit
1fcae03369
287 changed files with 5888 additions and 4608 deletions
|
@ -323,9 +323,12 @@ pub fn suggest_new_region_bound(
|
|||
.params
|
||||
.iter()
|
||||
.filter(|p| {
|
||||
matches!(p.kind, GenericParamKind::Lifetime {
|
||||
kind: hir::LifetimeParamKind::Explicit
|
||||
})
|
||||
matches!(
|
||||
p.kind,
|
||||
GenericParamKind::Lifetime {
|
||||
kind: hir::LifetimeParamKind::Explicit
|
||||
}
|
||||
)
|
||||
})
|
||||
.map(|p| {
|
||||
if let hir::ParamName::Plain(name) = p.name {
|
||||
|
|
|
@ -1837,13 +1837,16 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
span.push_span_label(self.tcx.def_span(other_trait_def_id), "this is the found trait");
|
||||
err.highlighted_span_note(span, vec![
|
||||
StringPart::normal("there are ".to_string()),
|
||||
StringPart::highlighted("multiple different versions".to_string()),
|
||||
StringPart::normal(" of crate `".to_string()),
|
||||
StringPart::highlighted(format!("{crate_name}")),
|
||||
StringPart::normal("` in the dependency graph\n".to_string()),
|
||||
]);
|
||||
err.highlighted_span_note(
|
||||
span,
|
||||
vec![
|
||||
StringPart::normal("there are ".to_string()),
|
||||
StringPart::highlighted("multiple different versions".to_string()),
|
||||
StringPart::normal(" of crate `".to_string()),
|
||||
StringPart::highlighted(format!("{crate_name}")),
|
||||
StringPart::normal("` in the dependency graph\n".to_string()),
|
||||
],
|
||||
);
|
||||
if points_at_type {
|
||||
// We only clarify that the same type from different crate versions are not the
|
||||
// same when we *find* the same type coming from different crate versions, otherwise
|
||||
|
@ -2977,12 +2980,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
.inputs
|
||||
.iter()
|
||||
.map(|arg| match arg.kind {
|
||||
hir::TyKind::Tup(tys) => {
|
||||
ArgKind::Tuple(Some(arg.span), vec![
|
||||
("_".to_owned(), "_".to_owned());
|
||||
tys.len()
|
||||
])
|
||||
}
|
||||
hir::TyKind::Tup(tys) => ArgKind::Tuple(
|
||||
Some(arg.span),
|
||||
vec![("_".to_owned(), "_".to_owned()); tys.len()],
|
||||
),
|
||||
_ => ArgKind::empty(),
|
||||
})
|
||||
.collect::<Vec<ArgKind>>(),
|
||||
|
|
|
@ -640,10 +640,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
}
|
||||
// Empty suggestions with empty spans ICE with debug assertions
|
||||
if steps == 0 {
|
||||
return (msg.trim_end_matches(" and dereferencing instead"), vec![(
|
||||
prefix_span,
|
||||
String::new(),
|
||||
)]);
|
||||
return (
|
||||
msg.trim_end_matches(" and dereferencing instead"),
|
||||
vec![(prefix_span, String::new())],
|
||||
);
|
||||
}
|
||||
let derefs = "*".repeat(steps);
|
||||
let needs_parens = steps > 0
|
||||
|
@ -3552,10 +3552,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
}
|
||||
ObligationCauseCode::TrivialBound => {
|
||||
err.help("see issue #48214");
|
||||
tcx.disabled_nightly_features(err, Some(tcx.local_def_id_to_hir_id(body_id)), [(
|
||||
String::new(),
|
||||
sym::trivial_bounds,
|
||||
)]);
|
||||
tcx.disabled_nightly_features(
|
||||
err,
|
||||
Some(tcx.local_def_id_to_hir_id(body_id)),
|
||||
[(String::new(), sym::trivial_bounds)],
|
||||
);
|
||||
}
|
||||
ObligationCauseCode::OpaqueReturnType(expr_info) => {
|
||||
let (expr_ty, expr) = if let Some((expr_ty, hir_id)) = expr_info {
|
||||
|
|
|
@ -153,10 +153,10 @@ fn find_best_leaf_obligation<'tcx>(
|
|||
infcx
|
||||
.fudge_inference_if_ok(|| {
|
||||
infcx
|
||||
.visit_proof_tree(obligation.clone().into(), &mut BestObligation {
|
||||
obligation: obligation.clone(),
|
||||
consider_ambiguities,
|
||||
})
|
||||
.visit_proof_tree(
|
||||
obligation.clone().into(),
|
||||
&mut BestObligation { obligation: obligation.clone(), consider_ambiguities },
|
||||
)
|
||||
.break_value()
|
||||
.ok_or(())
|
||||
})
|
||||
|
|
|
@ -130,11 +130,12 @@ where
|
|||
self.depth += 1;
|
||||
|
||||
let new_infer_ct = infcx.next_const_var(self.at.cause.span);
|
||||
let obligation =
|
||||
Obligation::new(tcx, self.at.cause.clone(), self.at.param_env, ty::NormalizesTo {
|
||||
alias: uv.into(),
|
||||
term: new_infer_ct.into(),
|
||||
});
|
||||
let obligation = Obligation::new(
|
||||
tcx,
|
||||
self.at.cause.clone(),
|
||||
self.at.param_env,
|
||||
ty::NormalizesTo { alias: uv.into(), term: new_infer_ct.into() },
|
||||
);
|
||||
|
||||
let result = if infcx.predicate_may_hold(&obligation) {
|
||||
self.fulfill_cx.register_predicate_obligation(infcx, obligation);
|
||||
|
@ -252,20 +253,20 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for DeeplyNormalizeForDiagnosticsFolder<'_,
|
|||
}
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
deeply_normalize_with_skipped_universes(self.at, ty, vec![
|
||||
None;
|
||||
ty.outer_exclusive_binder()
|
||||
.as_usize()
|
||||
])
|
||||
deeply_normalize_with_skipped_universes(
|
||||
self.at,
|
||||
ty,
|
||||
vec![None; ty.outer_exclusive_binder().as_usize()],
|
||||
)
|
||||
.unwrap_or_else(|_: Vec<ScrubbedTraitError<'tcx>>| ty.super_fold_with(self))
|
||||
}
|
||||
|
||||
fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
|
||||
deeply_normalize_with_skipped_universes(self.at, ct, vec![
|
||||
None;
|
||||
ct.outer_exclusive_binder()
|
||||
.as_usize()
|
||||
])
|
||||
deeply_normalize_with_skipped_universes(
|
||||
self.at,
|
||||
ct,
|
||||
vec![None; ct.outer_exclusive_binder().as_usize()],
|
||||
)
|
||||
.unwrap_or_else(|_: Vec<ScrubbedTraitError<'tcx>>| ct.super_fold_with(self))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,9 +368,10 @@ fn impl_intersection_has_impossible_obligation<'a, 'cx, 'tcx>(
|
|||
overflowing_predicates: ambiguities
|
||||
.into_iter()
|
||||
.filter(|error| {
|
||||
matches!(error.code, FulfillmentErrorCode::Ambiguity {
|
||||
overflow: Some(true)
|
||||
})
|
||||
matches!(
|
||||
error.code,
|
||||
FulfillmentErrorCode::Ambiguity { overflow: Some(true) }
|
||||
)
|
||||
})
|
||||
.map(|e| infcx.resolve_vars_if_possible(e.obligation.predicate))
|
||||
.collect(),
|
||||
|
@ -491,13 +492,16 @@ fn plug_infer_with_placeholders<'tcx>(
|
|||
// Comparing against a type variable never registers hidden types anyway
|
||||
DefineOpaqueTypes::Yes,
|
||||
ty,
|
||||
Ty::new_placeholder(self.infcx.tcx, ty::Placeholder {
|
||||
universe: self.universe,
|
||||
bound: ty::BoundTy {
|
||||
var: self.next_var(),
|
||||
kind: ty::BoundTyKind::Anon,
|
||||
Ty::new_placeholder(
|
||||
self.infcx.tcx,
|
||||
ty::Placeholder {
|
||||
universe: self.universe,
|
||||
bound: ty::BoundTy {
|
||||
var: self.next_var(),
|
||||
kind: ty::BoundTyKind::Anon,
|
||||
},
|
||||
},
|
||||
}),
|
||||
),
|
||||
)
|
||||
else {
|
||||
bug!("we always expect to be able to plug an infer var with placeholder")
|
||||
|
@ -517,10 +521,10 @@ fn plug_infer_with_placeholders<'tcx>(
|
|||
// registration happening anyway.
|
||||
DefineOpaqueTypes::Yes,
|
||||
ct,
|
||||
ty::Const::new_placeholder(self.infcx.tcx, ty::Placeholder {
|
||||
universe: self.universe,
|
||||
bound: self.next_var(),
|
||||
}),
|
||||
ty::Const::new_placeholder(
|
||||
self.infcx.tcx,
|
||||
ty::Placeholder { universe: self.universe, bound: self.next_var() },
|
||||
),
|
||||
)
|
||||
else {
|
||||
bug!("we always expect to be able to plug an infer var with placeholder")
|
||||
|
@ -545,13 +549,16 @@ fn plug_infer_with_placeholders<'tcx>(
|
|||
// Lifetimes don't contain opaque types (or any types for that matter).
|
||||
DefineOpaqueTypes::Yes,
|
||||
r,
|
||||
ty::Region::new_placeholder(self.infcx.tcx, ty::Placeholder {
|
||||
universe: self.universe,
|
||||
bound: ty::BoundRegion {
|
||||
var: self.next_var(),
|
||||
kind: ty::BoundRegionKind::Anon,
|
||||
ty::Region::new_placeholder(
|
||||
self.infcx.tcx,
|
||||
ty::Placeholder {
|
||||
universe: self.universe,
|
||||
bound: ty::BoundRegion {
|
||||
var: self.next_var(),
|
||||
kind: ty::BoundRegionKind::Anon,
|
||||
},
|
||||
},
|
||||
}),
|
||||
),
|
||||
)
|
||||
else {
|
||||
bug!("we always expect to be able to plug an infer var with placeholder")
|
||||
|
@ -763,9 +770,9 @@ fn search_ambiguity_causes<'tcx>(
|
|||
causes: &mut FxIndexSet<IntercrateAmbiguityCause<'tcx>>,
|
||||
) {
|
||||
infcx.probe(|_| {
|
||||
infcx.visit_proof_tree(goal, &mut AmbiguityCausesVisitor {
|
||||
cache: Default::default(),
|
||||
causes,
|
||||
})
|
||||
infcx.visit_proof_tree(
|
||||
goal,
|
||||
&mut AmbiguityCausesVisitor { cache: Default::default(), causes },
|
||||
)
|
||||
});
|
||||
}
|
||||
|
|
|
@ -660,13 +660,16 @@ fn replace_param_and_infer_args_with_placeholder<'tcx>(
|
|||
self.idx += 1;
|
||||
idx
|
||||
};
|
||||
Ty::new_placeholder(self.tcx, ty::PlaceholderType {
|
||||
universe: ty::UniverseIndex::ROOT,
|
||||
bound: ty::BoundTy {
|
||||
var: ty::BoundVar::from_u32(idx),
|
||||
kind: ty::BoundTyKind::Anon,
|
||||
Ty::new_placeholder(
|
||||
self.tcx,
|
||||
ty::PlaceholderType {
|
||||
universe: ty::UniverseIndex::ROOT,
|
||||
bound: ty::BoundTy {
|
||||
var: ty::BoundVar::from_u32(idx),
|
||||
kind: ty::BoundTyKind::Anon,
|
||||
},
|
||||
},
|
||||
})
|
||||
)
|
||||
} else {
|
||||
t.super_fold_with(self)
|
||||
}
|
||||
|
@ -674,14 +677,17 @@ fn replace_param_and_infer_args_with_placeholder<'tcx>(
|
|||
|
||||
fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> {
|
||||
if let ty::ConstKind::Infer(_) = c.kind() {
|
||||
ty::Const::new_placeholder(self.tcx, ty::PlaceholderConst {
|
||||
universe: ty::UniverseIndex::ROOT,
|
||||
bound: ty::BoundVar::from_u32({
|
||||
let idx = self.idx;
|
||||
self.idx += 1;
|
||||
idx
|
||||
}),
|
||||
})
|
||||
ty::Const::new_placeholder(
|
||||
self.tcx,
|
||||
ty::PlaceholderConst {
|
||||
universe: ty::UniverseIndex::ROOT,
|
||||
bound: ty::BoundVar::from_u32({
|
||||
let idx = self.idx;
|
||||
self.idx += 1;
|
||||
idx
|
||||
}),
|
||||
},
|
||||
)
|
||||
} else {
|
||||
c.super_fold_with(self)
|
||||
}
|
||||
|
|
|
@ -1670,14 +1670,18 @@ fn confirm_closure_candidate<'cx, 'tcx>(
|
|||
} else {
|
||||
let upvars_projection_def_id =
|
||||
tcx.require_lang_item(LangItem::AsyncFnKindUpvars, None);
|
||||
let tupled_upvars_ty = Ty::new_projection(tcx, upvars_projection_def_id, [
|
||||
ty::GenericArg::from(kind_ty),
|
||||
Ty::from_closure_kind(tcx, ty::ClosureKind::FnOnce).into(),
|
||||
tcx.lifetimes.re_static.into(),
|
||||
sig.tupled_inputs_ty.into(),
|
||||
args.tupled_upvars_ty().into(),
|
||||
args.coroutine_captures_by_ref_ty().into(),
|
||||
]);
|
||||
let tupled_upvars_ty = Ty::new_projection(
|
||||
tcx,
|
||||
upvars_projection_def_id,
|
||||
[
|
||||
ty::GenericArg::from(kind_ty),
|
||||
Ty::from_closure_kind(tcx, ty::ClosureKind::FnOnce).into(),
|
||||
tcx.lifetimes.re_static.into(),
|
||||
sig.tupled_inputs_ty.into(),
|
||||
args.tupled_upvars_ty().into(),
|
||||
args.coroutine_captures_by_ref_ty().into(),
|
||||
],
|
||||
);
|
||||
sig.to_coroutine(
|
||||
tcx,
|
||||
args.parent_args(),
|
||||
|
@ -1795,14 +1799,18 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
|
|||
// will project to the right upvars for the generator, appending the inputs and
|
||||
// coroutine upvars respecting the closure kind.
|
||||
// N.B. No need to register a `AsyncFnKindHelper` goal here, it's already in `nested`.
|
||||
let tupled_upvars_ty = Ty::new_projection(tcx, upvars_projection_def_id, [
|
||||
ty::GenericArg::from(kind_ty),
|
||||
Ty::from_closure_kind(tcx, goal_kind).into(),
|
||||
env_region.into(),
|
||||
sig.tupled_inputs_ty.into(),
|
||||
args.tupled_upvars_ty().into(),
|
||||
args.coroutine_captures_by_ref_ty().into(),
|
||||
]);
|
||||
let tupled_upvars_ty = Ty::new_projection(
|
||||
tcx,
|
||||
upvars_projection_def_id,
|
||||
[
|
||||
ty::GenericArg::from(kind_ty),
|
||||
Ty::from_closure_kind(tcx, goal_kind).into(),
|
||||
env_region.into(),
|
||||
sig.tupled_inputs_ty.into(),
|
||||
args.tupled_upvars_ty().into(),
|
||||
args.coroutine_captures_by_ref_ty().into(),
|
||||
],
|
||||
);
|
||||
sig.to_coroutine(
|
||||
tcx,
|
||||
args.parent_args(),
|
||||
|
@ -1816,17 +1824,16 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
|
|||
name => bug!("no such associated type: {name}"),
|
||||
};
|
||||
let projection_term = match item_name {
|
||||
sym::CallOnceFuture | sym::Output => {
|
||||
ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
|
||||
self_ty,
|
||||
sig.tupled_inputs_ty,
|
||||
])
|
||||
}
|
||||
sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
|
||||
ty::GenericArg::from(self_ty),
|
||||
sig.tupled_inputs_ty.into(),
|
||||
env_region.into(),
|
||||
]),
|
||||
sym::CallOnceFuture | sym::Output => ty::AliasTerm::new(
|
||||
tcx,
|
||||
obligation.predicate.def_id,
|
||||
[self_ty, sig.tupled_inputs_ty],
|
||||
),
|
||||
sym::CallRefFuture => ty::AliasTerm::new(
|
||||
tcx,
|
||||
obligation.predicate.def_id,
|
||||
[ty::GenericArg::from(self_ty), sig.tupled_inputs_ty.into(), env_region.into()],
|
||||
),
|
||||
name => bug!("no such associated type: {name}"),
|
||||
};
|
||||
|
||||
|
@ -1846,17 +1853,20 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
|
|||
name => bug!("no such associated type: {name}"),
|
||||
};
|
||||
let projection_term = match item_name {
|
||||
sym::CallOnceFuture | sym::Output => {
|
||||
ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
|
||||
self_ty,
|
||||
Ty::new_tup(tcx, sig.inputs()),
|
||||
])
|
||||
}
|
||||
sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
|
||||
ty::GenericArg::from(self_ty),
|
||||
Ty::new_tup(tcx, sig.inputs()).into(),
|
||||
env_region.into(),
|
||||
]),
|
||||
sym::CallOnceFuture | sym::Output => ty::AliasTerm::new(
|
||||
tcx,
|
||||
obligation.predicate.def_id,
|
||||
[self_ty, Ty::new_tup(tcx, sig.inputs())],
|
||||
),
|
||||
sym::CallRefFuture => ty::AliasTerm::new(
|
||||
tcx,
|
||||
obligation.predicate.def_id,
|
||||
[
|
||||
ty::GenericArg::from(self_ty),
|
||||
Ty::new_tup(tcx, sig.inputs()).into(),
|
||||
env_region.into(),
|
||||
],
|
||||
),
|
||||
name => bug!("no such associated type: {name}"),
|
||||
};
|
||||
|
||||
|
@ -1879,11 +1889,11 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
|
|||
sym::CallOnceFuture | sym::Output => {
|
||||
ty::AliasTerm::new(tcx, obligation.predicate.def_id, [self_ty, sig.inputs()[0]])
|
||||
}
|
||||
sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
|
||||
ty::GenericArg::from(self_ty),
|
||||
sig.inputs()[0].into(),
|
||||
env_region.into(),
|
||||
]),
|
||||
sym::CallRefFuture => ty::AliasTerm::new(
|
||||
tcx,
|
||||
obligation.predicate.def_id,
|
||||
[ty::GenericArg::from(self_ty), sig.inputs()[0].into(), env_region.into()],
|
||||
),
|
||||
name => bug!("no such associated type: {name}"),
|
||||
};
|
||||
|
||||
|
|
|
@ -301,11 +301,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let make_transmute_obl = |src, dst| {
|
||||
let transmute_trait = obligation.predicate.def_id();
|
||||
let assume = obligation.predicate.skip_binder().trait_ref.args.const_at(2);
|
||||
let trait_ref = ty::TraitRef::new(tcx, transmute_trait, [
|
||||
ty::GenericArg::from(dst),
|
||||
ty::GenericArg::from(src),
|
||||
ty::GenericArg::from(assume),
|
||||
]);
|
||||
let trait_ref = ty::TraitRef::new(
|
||||
tcx,
|
||||
transmute_trait,
|
||||
[
|
||||
ty::GenericArg::from(dst),
|
||||
ty::GenericArg::from(src),
|
||||
ty::GenericArg::from(assume),
|
||||
],
|
||||
);
|
||||
Obligation::with_depth(
|
||||
tcx,
|
||||
obligation.cause.clone(),
|
||||
|
@ -316,10 +320,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
};
|
||||
|
||||
let make_freeze_obl = |ty| {
|
||||
let trait_ref =
|
||||
ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::Freeze, None), [
|
||||
ty::GenericArg::from(ty),
|
||||
]);
|
||||
let trait_ref = ty::TraitRef::new(
|
||||
tcx,
|
||||
tcx.require_lang_item(LangItem::Freeze, None),
|
||||
[ty::GenericArg::from(ty)],
|
||||
);
|
||||
Obligation::with_depth(
|
||||
tcx,
|
||||
obligation.cause.clone(),
|
||||
|
@ -863,10 +868,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
ty::CoroutineClosure(_, args) => {
|
||||
args.as_coroutine_closure().coroutine_closure_sig().map_bound(|sig| {
|
||||
ty::TraitRef::new(self.tcx(), obligation.predicate.def_id(), [
|
||||
self_ty,
|
||||
sig.tupled_inputs_ty,
|
||||
])
|
||||
ty::TraitRef::new(
|
||||
self.tcx(),
|
||||
obligation.predicate.def_id(),
|
||||
[self_ty, sig.tupled_inputs_ty],
|
||||
)
|
||||
})
|
||||
}
|
||||
_ => {
|
||||
|
@ -892,10 +898,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
ty::CoroutineClosure(_, args) => {
|
||||
let args = args.as_coroutine_closure();
|
||||
let trait_ref = args.coroutine_closure_sig().map_bound(|sig| {
|
||||
ty::TraitRef::new(self.tcx(), obligation.predicate.def_id(), [
|
||||
self_ty,
|
||||
sig.tupled_inputs_ty,
|
||||
])
|
||||
ty::TraitRef::new(
|
||||
self.tcx(),
|
||||
obligation.predicate.def_id(),
|
||||
[self_ty, sig.tupled_inputs_ty],
|
||||
)
|
||||
});
|
||||
|
||||
// Note that unlike below, we don't need to check `Future + Sized` for
|
||||
|
@ -906,10 +913,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
ty::FnDef(..) | ty::FnPtr(..) => {
|
||||
let sig = self_ty.fn_sig(tcx);
|
||||
let trait_ref = sig.map_bound(|sig| {
|
||||
ty::TraitRef::new(self.tcx(), obligation.predicate.def_id(), [
|
||||
self_ty,
|
||||
Ty::new_tup(tcx, sig.inputs()),
|
||||
])
|
||||
ty::TraitRef::new(
|
||||
self.tcx(),
|
||||
obligation.predicate.def_id(),
|
||||
[self_ty, Ty::new_tup(tcx, sig.inputs())],
|
||||
)
|
||||
});
|
||||
|
||||
// We must additionally check that the return type impls `Future + Sized`.
|
||||
|
@ -934,10 +942,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let args = args.as_closure();
|
||||
let sig = args.sig();
|
||||
let trait_ref = sig.map_bound(|sig| {
|
||||
ty::TraitRef::new(self.tcx(), obligation.predicate.def_id(), [
|
||||
self_ty,
|
||||
sig.inputs()[0],
|
||||
])
|
||||
ty::TraitRef::new(
|
||||
self.tcx(),
|
||||
obligation.predicate.def_id(),
|
||||
[self_ty, sig.inputs()[0]],
|
||||
)
|
||||
});
|
||||
|
||||
// We must additionally check that the return type impls `Future + Sized`.
|
||||
|
@ -1295,10 +1304,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// Construct the nested `TailField<T>: Unsize<TailField<U>>` predicate.
|
||||
let tail_unsize_obligation = obligation.with(
|
||||
tcx,
|
||||
ty::TraitRef::new(tcx, obligation.predicate.def_id(), [
|
||||
source_tail,
|
||||
target_tail,
|
||||
]),
|
||||
ty::TraitRef::new(
|
||||
tcx,
|
||||
obligation.predicate.def_id(),
|
||||
[source_tail, target_tail],
|
||||
),
|
||||
);
|
||||
nested.push(tail_unsize_obligation);
|
||||
|
||||
|
@ -1359,10 +1369,11 @@ fn pointer_like_goal_for_rpitit<'tcx>(
|
|||
ty::GenericParamDefKind::Lifetime => {
|
||||
let kind = ty::BoundRegionKind::Named(arg.def_id, tcx.item_name(arg.def_id));
|
||||
bound_vars.push(ty::BoundVariableKind::Region(kind));
|
||||
ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
|
||||
var: ty::BoundVar::from_usize(bound_vars.len() - 1),
|
||||
kind,
|
||||
})
|
||||
ty::Region::new_bound(
|
||||
tcx,
|
||||
ty::INNERMOST,
|
||||
ty::BoundRegion { var: ty::BoundVar::from_usize(bound_vars.len() - 1), kind },
|
||||
)
|
||||
.into()
|
||||
}
|
||||
ty::GenericParamDefKind::Type { .. } | ty::GenericParamDefKind::Const { .. } => {
|
||||
|
@ -1371,9 +1382,11 @@ fn pointer_like_goal_for_rpitit<'tcx>(
|
|||
});
|
||||
|
||||
ty::Binder::bind_with_vars(
|
||||
ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::PointerLike, Some(cause.span)), [
|
||||
Ty::new_projection_from_args(tcx, rpitit_item, args),
|
||||
]),
|
||||
ty::TraitRef::new(
|
||||
tcx,
|
||||
tcx.require_lang_item(LangItem::PointerLike, Some(cause.span)),
|
||||
[Ty::new_projection_from_args(tcx, rpitit_item, args)],
|
||||
),
|
||||
tcx.mk_bound_variable_kinds(&bound_vars),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -2422,9 +2422,11 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
|||
} else {
|
||||
// If this is an ill-formed auto/built-in trait, then synthesize
|
||||
// new error args for the missing generics.
|
||||
let err_args = ty::GenericArgs::extend_with_error(tcx, trait_def_id, &[
|
||||
normalized_ty.into(),
|
||||
]);
|
||||
let err_args = ty::GenericArgs::extend_with_error(
|
||||
tcx,
|
||||
trait_def_id,
|
||||
&[normalized_ty.into()],
|
||||
);
|
||||
ty::TraitRef::new_from_args(tcx, trait_def_id, err_args)
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue