Skip to content

Commit cdf51f2

Browse files
committed
Add new_empty_tuple
1 parent 84388ce commit cdf51f2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

crates/hir-ty/src/mir/eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_apfloat::{
2525
ieee::{Half as f16, Quad as f128},
2626
};
2727
use rustc_hash::{FxHashMap, FxHashSet};
28-
use rustc_type_ir::inherent::{AdtDef, IntoKind, SliceLike, Ty as _};
28+
use rustc_type_ir::inherent::{AdtDef, IntoKind, SliceLike};
2929
use span::FileId;
3030
use stdx::never;
3131
use syntax::{SyntaxNodePtr, TextRange};
@@ -1815,7 +1815,7 @@ impl<'db> Evaluator<'db> {
18151815
let i = self.const_eval_discriminant(it)?;
18161816
return Ok((
18171817
16,
1818-
self.layout(crate::next_solver::Ty::new_tup(interner, &[]))?,
1818+
self.layout(crate::next_solver::Ty::new_empty_tuple(interner))?,
18191819
Some((0, 16, i)),
18201820
));
18211821
}

crates/hir-ty/src/next_solver/ty.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_type_ir::{
99
WithCachedTypeInfo,
1010
inherent::{
1111
AdtDef, BoundVarLike, GenericArgs as _, IntoKind, ParamLike, PlaceholderLike, SliceLike,
12+
Ty as _,
1213
},
1314
relate::Relate,
1415
solve::SizedTraitKind,
@@ -107,6 +108,10 @@ impl<'db> Ty<'db> {
107108
Ty::new_infer(interner, InferTy::FreshFloatTy(n))
108109
}
109110

111+
pub fn new_empty_tuple(interner: DbInterner<'db>) -> Self {
112+
Ty::new_tup(interner, &[])
113+
}
114+
110115
/// Returns the `Size` for primitive types (bool, uint, int, char, float).
111116
pub fn primitive_size(self, interner: DbInterner<'db>) -> Size {
112117
match self.kind() {

0 commit comments

Comments
 (0)