diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-16 11:47:50 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-17 22:24:31 +1100 |
| commit | bcf0ec019172ccb34e2f53c07cd3b76d506d249a (patch) | |
| tree | c4c34ce6df6c6c92827b71c0cac8e72756881229 /compiler/rustc_middle/src/ty | |
| parent | 9556b56dbdbd4238f0051e7230004b0aa488fa14 (diff) | |
| download | rust-bcf0ec019172ccb34e2f53c07cd3b76d506d249a.tar.gz rust-bcf0ec019172ccb34e2f53c07cd3b76d506d249a.zip | |
Replace `mk_foo` calls with `infer_foo` where possible.
There are several `mk_foo`/`intern_foo` pairs, where the former takes an iterator and the latter takes a slice. (This naming convention is bad, but that's a fix for another PR.) This commit changes several `mk_foo` occurrences into `intern_foo`, avoiding the need for some `.iter()`/`.into_iter()` calls. Affected cases: - mk_type_list - mk_tup - mk_substs - mk_const_list
Diffstat (limited to 'compiler/rustc_middle/src/ty')
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/layout.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/relate.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/structural_impls.rs | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 117f3decd1a..79879ea20ab 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1190,7 +1190,7 @@ impl<'tcx> TyCtxt<'tcx> { self.mk_imm_ref( self.lifetimes.re_static, self.type_of(self.require_lang_item(LangItem::PanicLocation, None)) - .subst(self, self.mk_substs([self.lifetimes.re_static.into()].iter())), + .subst(self, self.intern_substs(&[self.lifetimes.re_static.into()])), ) } diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 1d76f435e26..3d0f9a5053c 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -686,7 +686,7 @@ where Increase this counter if you tried to implement this but failed to do it without duplicating a lot of code from other places in the compiler: 2 - tcx.mk_tup(&[ + tcx.intern_tup(&[ tcx.mk_array(tcx.types.usize, 3), tcx.mk_array(Option<fn()>), ]) diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 322afeb2d34..2ba25e8bfad 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -673,7 +673,7 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>( for (a_arg, b_arg) in aa.iter().zip(ba.iter()) { related_args.push(r.consts(a_arg, b_arg)?); } - let related_args = tcx.mk_const_list(related_args.iter()); + let related_args = tcx.intern_const_list(&related_args); Expr::FunctionCall(func, related_args) } _ => return Err(TypeError::ConstMismatch(expected_found(r, a, b))), diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 97ee2b1fc5d..9c1a6f716d0 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -418,7 +418,7 @@ impl<'tcx> ir::TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<ty::PolyExistential impl<'tcx> ir::TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<ty::Const<'tcx>> { fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> { - ty::util::fold_list(self, folder, |tcx, v| tcx.mk_const_list(v.iter())) + ty::util::fold_list(self, folder, |tcx, v| tcx.intern_const_list(v)) } } |
