mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 19:17:12 +00:00
Add new_empty_tuple
This commit is contained in:
parent
84388ceb0e
commit
cdf51f28f4
2 changed files with 7 additions and 2 deletions
|
|
@ -25,7 +25,7 @@ use rustc_apfloat::{
|
|||
ieee::{Half as f16, Quad as f128},
|
||||
};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use rustc_type_ir::inherent::{AdtDef, IntoKind, SliceLike, Ty as _};
|
||||
use rustc_type_ir::inherent::{AdtDef, IntoKind, SliceLike};
|
||||
use span::FileId;
|
||||
use stdx::never;
|
||||
use syntax::{SyntaxNodePtr, TextRange};
|
||||
|
|
@ -1815,7 +1815,7 @@ impl<'db> Evaluator<'db> {
|
|||
let i = self.const_eval_discriminant(it)?;
|
||||
return Ok((
|
||||
16,
|
||||
self.layout(crate::next_solver::Ty::new_tup(interner, &[]))?,
|
||||
self.layout(crate::next_solver::Ty::new_empty_tuple(interner))?,
|
||||
Some((0, 16, i)),
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use rustc_type_ir::{
|
|||
WithCachedTypeInfo,
|
||||
inherent::{
|
||||
AdtDef, BoundVarLike, GenericArgs as _, IntoKind, ParamLike, PlaceholderLike, SliceLike,
|
||||
Ty as _,
|
||||
},
|
||||
relate::Relate,
|
||||
solve::SizedTraitKind,
|
||||
|
|
@ -107,6 +108,10 @@ impl<'db> Ty<'db> {
|
|||
Ty::new_infer(interner, InferTy::FreshFloatTy(n))
|
||||
}
|
||||
|
||||
pub fn new_empty_tuple(interner: DbInterner<'db>) -> Self {
|
||||
Ty::new_tup(interner, &[])
|
||||
}
|
||||
|
||||
/// Returns the `Size` for primitive types (bool, uint, int, char, float).
|
||||
pub fn primitive_size(self, interner: DbInterner<'db>) -> Size {
|
||||
match self.kind() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue