mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 04:18:20 +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},
|
ieee::{Half as f16, Quad as f128},
|
||||||
};
|
};
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
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 span::FileId;
|
||||||
use stdx::never;
|
use stdx::never;
|
||||||
use syntax::{SyntaxNodePtr, TextRange};
|
use syntax::{SyntaxNodePtr, TextRange};
|
||||||
|
|
@ -1815,7 +1815,7 @@ impl<'db> Evaluator<'db> {
|
||||||
let i = self.const_eval_discriminant(it)?;
|
let i = self.const_eval_discriminant(it)?;
|
||||||
return Ok((
|
return Ok((
|
||||||
16,
|
16,
|
||||||
self.layout(crate::next_solver::Ty::new_tup(interner, &[]))?,
|
self.layout(crate::next_solver::Ty::new_empty_tuple(interner))?,
|
||||||
Some((0, 16, i)),
|
Some((0, 16, i)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ use rustc_type_ir::{
|
||||||
WithCachedTypeInfo,
|
WithCachedTypeInfo,
|
||||||
inherent::{
|
inherent::{
|
||||||
AdtDef, BoundVarLike, GenericArgs as _, IntoKind, ParamLike, PlaceholderLike, SliceLike,
|
AdtDef, BoundVarLike, GenericArgs as _, IntoKind, ParamLike, PlaceholderLike, SliceLike,
|
||||||
|
Ty as _,
|
||||||
},
|
},
|
||||||
relate::Relate,
|
relate::Relate,
|
||||||
solve::SizedTraitKind,
|
solve::SizedTraitKind,
|
||||||
|
|
@ -107,6 +108,10 @@ impl<'db> Ty<'db> {
|
||||||
Ty::new_infer(interner, InferTy::FreshFloatTy(n))
|
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).
|
/// Returns the `Size` for primitive types (bool, uint, int, char, float).
|
||||||
pub fn primitive_size(self, interner: DbInterner<'db>) -> Size {
|
pub fn primitive_size(self, interner: DbInterner<'db>) -> Size {
|
||||||
match self.kind() {
|
match self.kind() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue