mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
use rustc crates instead of copy paste
This commit is contained in:
parent
f2c9502185
commit
05906da0ec
13 changed files with 291 additions and 2083 deletions
|
@ -994,8 +994,30 @@ impl Enum {
|
|||
Type::new_for_crate(
|
||||
self.id.lookup(db.upcast()).container.krate(),
|
||||
TyBuilder::builtin(match db.enum_data(self.id).variant_body_type() {
|
||||
Either::Left(builtin) => hir_def::builtin_type::BuiltinType::Int(builtin),
|
||||
Either::Right(builtin) => hir_def::builtin_type::BuiltinType::Uint(builtin),
|
||||
hir_def::layout::IntegerType::Pointer(sign) => match sign {
|
||||
true => hir_def::builtin_type::BuiltinType::Int(
|
||||
hir_def::builtin_type::BuiltinInt::Isize,
|
||||
),
|
||||
false => hir_def::builtin_type::BuiltinType::Uint(
|
||||
hir_def::builtin_type::BuiltinUint::Usize,
|
||||
),
|
||||
},
|
||||
hir_def::layout::IntegerType::Fixed(i, sign) => match sign {
|
||||
true => hir_def::builtin_type::BuiltinType::Int(match i {
|
||||
hir_def::layout::Integer::I8 => hir_def::builtin_type::BuiltinInt::I8,
|
||||
hir_def::layout::Integer::I16 => hir_def::builtin_type::BuiltinInt::I16,
|
||||
hir_def::layout::Integer::I32 => hir_def::builtin_type::BuiltinInt::I32,
|
||||
hir_def::layout::Integer::I64 => hir_def::builtin_type::BuiltinInt::I64,
|
||||
hir_def::layout::Integer::I128 => hir_def::builtin_type::BuiltinInt::I128,
|
||||
}),
|
||||
false => hir_def::builtin_type::BuiltinType::Uint(match i {
|
||||
hir_def::layout::Integer::I8 => hir_def::builtin_type::BuiltinUint::U8,
|
||||
hir_def::layout::Integer::I16 => hir_def::builtin_type::BuiltinUint::U16,
|
||||
hir_def::layout::Integer::I32 => hir_def::builtin_type::BuiltinUint::U32,
|
||||
hir_def::layout::Integer::I64 => hir_def::builtin_type::BuiltinUint::U64,
|
||||
hir_def::layout::Integer::I128 => hir_def::builtin_type::BuiltinUint::U128,
|
||||
}),
|
||||
},
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue