Auto merge of #108112 - nnethercote:clarify-iterator-interners, r=oli-obk,compiler-errors
Clarify iterator interners I found the iterator interners very confusing. This PR clarifies things. r? `@compiler-errors`
This commit is contained in:
commit
a9842c73bc
36 changed files with 173 additions and 186 deletions
|
@ -1936,7 +1936,7 @@ pub(super) fn check_type_bounds<'tcx>(
|
|||
.into()
|
||||
}
|
||||
});
|
||||
let bound_vars = tcx.mk_bound_variable_kinds(bound_vars.into_iter());
|
||||
let bound_vars = tcx.intern_bound_variable_kinds(&bound_vars);
|
||||
let impl_ty_substs = tcx.intern_substs(&substs);
|
||||
let container_id = impl_ty.container_id(tcx);
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ use rustc_middle::ty::{self, TyCtxt};
|
|||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use std::iter;
|
||||
|
||||
fn equate_intrinsic_type<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
it: &hir::ForeignItem<'_>,
|
||||
|
@ -139,14 +137,10 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
|
|||
let intrinsic_name = tcx.item_name(intrinsic_id);
|
||||
let name_str = intrinsic_name.as_str();
|
||||
|
||||
let bound_vars = tcx.mk_bound_variable_kinds(
|
||||
[
|
||||
ty::BoundVariableKind::Region(ty::BrAnon(0, None)),
|
||||
ty::BoundVariableKind::Region(ty::BrEnv),
|
||||
]
|
||||
.iter()
|
||||
.copied(),
|
||||
);
|
||||
let bound_vars = tcx.intern_bound_variable_kinds(&[
|
||||
ty::BoundVariableKind::Region(ty::BrAnon(0, None)),
|
||||
ty::BoundVariableKind::Region(ty::BrEnv),
|
||||
]);
|
||||
let mk_va_list_ty = |mutbl| {
|
||||
tcx.lang_items().va_list().map(|did| {
|
||||
let region = tcx.mk_re_late_bound(
|
||||
|
@ -378,21 +372,21 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
|
|||
(
|
||||
1,
|
||||
vec![tcx.mk_imm_ref(tcx.mk_re_late_bound(ty::INNERMOST, br), param(0))],
|
||||
tcx.mk_projection(discriminant_def_id, tcx.mk_substs([param(0).into()].iter())),
|
||||
tcx.mk_projection(discriminant_def_id, tcx.intern_substs(&[param(0).into()])),
|
||||
)
|
||||
}
|
||||
|
||||
kw::Try => {
|
||||
let mut_u8 = tcx.mk_mut_ptr(tcx.types.u8);
|
||||
let try_fn_ty = ty::Binder::dummy(tcx.mk_fn_sig(
|
||||
iter::once(mut_u8),
|
||||
[mut_u8],
|
||||
tcx.mk_unit(),
|
||||
false,
|
||||
hir::Unsafety::Normal,
|
||||
Abi::Rust,
|
||||
));
|
||||
let catch_fn_ty = ty::Binder::dummy(tcx.mk_fn_sig(
|
||||
[mut_u8, mut_u8].iter().cloned(),
|
||||
[mut_u8, mut_u8],
|
||||
tcx.mk_unit(),
|
||||
false,
|
||||
hir::Unsafety::Normal,
|
||||
|
@ -447,7 +441,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
|
|||
};
|
||||
(n_tps, 0, inputs, output, unsafety)
|
||||
};
|
||||
let sig = tcx.mk_fn_sig(inputs.into_iter(), output, false, unsafety, Abi::RustIntrinsic);
|
||||
let sig = tcx.mk_fn_sig(inputs, output, false, unsafety, Abi::RustIntrinsic);
|
||||
let sig = ty::Binder::bind_with_vars(sig, bound_vars);
|
||||
equate_intrinsic_type(tcx, it, n_tps, n_lts, sig)
|
||||
}
|
||||
|
@ -545,13 +539,7 @@ pub fn check_platform_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>)
|
|||
}
|
||||
};
|
||||
|
||||
let sig = tcx.mk_fn_sig(
|
||||
inputs.into_iter(),
|
||||
output,
|
||||
false,
|
||||
hir::Unsafety::Unsafe,
|
||||
Abi::PlatformIntrinsic,
|
||||
);
|
||||
let sig = tcx.mk_fn_sig(inputs, output, false, hir::Unsafety::Unsafe, Abi::PlatformIntrinsic);
|
||||
let sig = ty::Binder::dummy(sig);
|
||||
equate_intrinsic_type(tcx, it, n_tps, 0, sig)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue