mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
split out AliasTy -> AliasTerm
This commit is contained in:
parent
e65cefcf6f
commit
760fbdf64e
@ -417,7 +417,7 @@ fn get_input_traits_and_projections<'tcx>(
|
||||
}
|
||||
},
|
||||
ClauseKind::Projection(projection_predicate) => {
|
||||
if projection_predicate.projection_ty.self_ty() == input {
|
||||
if projection_predicate.projection_term.self_ty() == input {
|
||||
projection_predicates.push(projection_predicate);
|
||||
}
|
||||
},
|
||||
|
@ -320,11 +320,11 @@ fn is_mixed_projection_predicate<'tcx>(
|
||||
&& (term_param_ty.index as usize) < generics.parent_count
|
||||
{
|
||||
// The inner-most self type is a type parameter from the current function.
|
||||
let mut projection_ty = projection_predicate.projection_ty;
|
||||
let mut projection_ty = projection_predicate.projection_term;
|
||||
loop {
|
||||
match projection_ty.self_ty().kind() {
|
||||
match *projection_ty.self_ty().kind() {
|
||||
ty::Alias(ty::Projection, inner_projection_ty) => {
|
||||
projection_ty = *inner_projection_ty;
|
||||
projection_ty = inner_projection_ty.into();
|
||||
},
|
||||
ty::Param(param_ty) => {
|
||||
return (param_ty.index as usize) >= generics.parent_count;
|
||||
@ -404,14 +404,11 @@ fn replace_types<'tcx>(
|
||||
// The `replaced.insert(...)` check provides some protection against infinite loops.
|
||||
if replaced.insert(param_ty.index) {
|
||||
for projection_predicate in projection_predicates {
|
||||
if projection_predicate.projection_ty.self_ty() == param_ty.to_ty(cx.tcx)
|
||||
if projection_predicate.projection_term.self_ty() == param_ty.to_ty(cx.tcx)
|
||||
&& let Some(term_ty) = projection_predicate.term.ty()
|
||||
&& let ty::Param(term_param_ty) = term_ty.kind()
|
||||
{
|
||||
let projection = cx.tcx.mk_ty_from_kind(ty::Alias(
|
||||
ty::Projection,
|
||||
projection_predicate.projection_ty.with_self_ty(cx.tcx, new_ty),
|
||||
));
|
||||
let projection = projection_predicate.projection_term.with_self_ty(cx.tcx, new_ty).expect_ty(cx.tcx).to_ty(cx.tcx);
|
||||
|
||||
if let Ok(projected_ty) = cx.tcx.try_normalize_erasing_regions(cx.param_env, projection)
|
||||
&& args[term_param_ty.index as usize] != GenericArg::from(projected_ty)
|
||||
|
@ -66,7 +66,7 @@ fn get_projection_pred<'tcx>(
|
||||
let projection_pred = cx
|
||||
.tcx
|
||||
.instantiate_bound_regions_with_erased(proj_pred.kind().rebind(pred));
|
||||
if projection_pred.projection_ty.args == trait_pred.trait_ref.args {
|
||||
if projection_pred.projection_term.args == trait_pred.trait_ref.args {
|
||||
return Some(projection_pred);
|
||||
}
|
||||
}
|
||||
|
@ -795,7 +795,7 @@ fn sig_from_bounds<'tcx>(
|
||||
inputs = Some(i);
|
||||
},
|
||||
ty::ClauseKind::Projection(p)
|
||||
if Some(p.projection_ty.def_id) == lang_items.fn_once_output() && p.projection_ty.self_ty() == ty =>
|
||||
if Some(p.projection_term.def_id) == lang_items.fn_once_output() && p.projection_term.self_ty() == ty =>
|
||||
{
|
||||
if output.is_some() {
|
||||
// Multiple different fn trait impls. Is this even allowed?
|
||||
@ -834,7 +834,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option
|
||||
}
|
||||
inputs = Some(i);
|
||||
},
|
||||
ty::ClauseKind::Projection(p) if Some(p.projection_ty.def_id) == lang_items.fn_once_output() => {
|
||||
ty::ClauseKind::Projection(p) if Some(p.projection_term.def_id) == lang_items.fn_once_output() => {
|
||||
if output.is_some() {
|
||||
// Multiple different fn trait impls. Is this even allowed?
|
||||
return None;
|
||||
|
Loading…
Reference in New Issue
Block a user