Apply nits
This commit is contained in:
parent
3bcdf3058e
commit
fa84018c2e
17 changed files with 73 additions and 137 deletions
|
@ -421,9 +421,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
);
|
||||
debug!(?alias_args);
|
||||
|
||||
// Note that we're indeed also using `AliasTy` (alias *type*) for associated
|
||||
// *constants* to represent *const projections*. Alias *term* would be a more
|
||||
// appropriate name but alas.
|
||||
ty::AliasTerm::new(tcx, assoc_item.def_id, alias_args)
|
||||
});
|
||||
|
||||
|
|
|
@ -625,22 +625,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
let bound_predicate = pred.kind();
|
||||
match bound_predicate.skip_binder() {
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::Projection(pred)) => {
|
||||
let pred = bound_predicate.rebind(pred);
|
||||
// `<Foo as Iterator>::Item = String`.
|
||||
let projection_term = pred.skip_binder().projection_term;
|
||||
|
||||
let args_with_infer_self = tcx.mk_args_from_iter(
|
||||
std::iter::once(Ty::new_var(tcx, ty::TyVid::ZERO).into())
|
||||
.chain(projection_term.args.iter().skip(1)),
|
||||
);
|
||||
|
||||
let quiet_projection_ty =
|
||||
ty::AliasTerm::new(tcx, projection_term.def_id, args_with_infer_self);
|
||||
|
||||
let term = pred.skip_binder().term;
|
||||
let projection_term = pred.projection_term;
|
||||
let quiet_projection_term =
|
||||
projection_term.with_self_ty(tcx, Ty::new_var(tcx, ty::TyVid::ZERO));
|
||||
|
||||
let term = pred.term;
|
||||
let obligation = format!("{projection_term} = {term}");
|
||||
let quiet = format!("{quiet_projection_ty} = {term}");
|
||||
let quiet = format!("{quiet_projection_term} = {term}");
|
||||
|
||||
bound_span_label(projection_term.self_ty(), &obligation, &quiet);
|
||||
Some((obligation, projection_term.self_ty()))
|
||||
|
|
|
@ -258,23 +258,20 @@ fn unconstrained_parent_impl_args<'tcx>(
|
|||
// unconstrained parameters.
|
||||
for (clause, _) in impl_generic_predicates.predicates.iter() {
|
||||
if let ty::ClauseKind::Projection(proj) = clause.kind().skip_binder() {
|
||||
let projection_term = proj.projection_term;
|
||||
let projected_term = proj.term;
|
||||
|
||||
let unbound_trait_ref = projection_term.trait_ref(tcx);
|
||||
let unbound_trait_ref = proj.projection_term.trait_ref(tcx);
|
||||
if Some(unbound_trait_ref) == impl_trait_ref {
|
||||
continue;
|
||||
}
|
||||
|
||||
unconstrained_parameters.extend(cgp::parameters_for(tcx, projection_term, true));
|
||||
unconstrained_parameters.extend(cgp::parameters_for(tcx, proj.projection_term, true));
|
||||
|
||||
for param in cgp::parameters_for(tcx, projected_term, false) {
|
||||
for param in cgp::parameters_for(tcx, proj.term, false) {
|
||||
if !unconstrained_parameters.contains(¶m) {
|
||||
constrained_params.insert(param.0);
|
||||
}
|
||||
}
|
||||
|
||||
unconstrained_parameters.extend(cgp::parameters_for(tcx, projected_term, true));
|
||||
unconstrained_parameters.extend(cgp::parameters_for(tcx, proj.term, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue