diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-28 13:36:44 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-28 13:36:44 +0000 |
commit | 803ff2e55eeb6bd1d9028fbbffe34721f0e6d459 (patch) | |
tree | c0df3cba7d22fe49e1ea33dde6ed8d4c9e0f663f /crates/hir_ty/src/display.rs | |
parent | 7f57a01b3d524a5ed85a30265b8aee2c81118f15 (diff) | |
parent | 7c2dd85a32e320fd412a720ea5b847c66bf246ae (diff) |
Merge #7804
7804: Introduce TypeCtor::Scalar r=lnicola a=Veykril
`TypeCtor::Int(..) | TypeCtor::Float(..) | TypeCtor::Char | TypeCtor::Bool` => `TypeCtor::Scalar(..)`, in this case we can actually just straight up use `chalk_ir::Scalar` already since its just a POD without any IDs or anything.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r-- | crates/hir_ty/src/display.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 271fcbfaf..b4801cb21 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs | |||
@@ -3,8 +3,9 @@ | |||
3 | use std::{borrow::Cow, fmt}; | 3 | use std::{borrow::Cow, fmt}; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | db::HirDatabase, utils::generics, ApplicationTy, CallableDefId, FnSig, GenericPredicate, | 6 | db::HirDatabase, primitive, utils::generics, ApplicationTy, CallableDefId, FnSig, |
7 | Lifetime, Obligation, OpaqueTy, OpaqueTyId, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, | 7 | GenericPredicate, Lifetime, Obligation, OpaqueTy, OpaqueTyId, ProjectionTy, Scalar, Substs, |
8 | TraitRef, Ty, TypeCtor, | ||
8 | }; | 9 | }; |
9 | use arrayvec::ArrayVec; | 10 | use arrayvec::ArrayVec; |
10 | use hir_def::{ | 11 | use hir_def::{ |
@@ -241,10 +242,13 @@ impl HirDisplay for ApplicationTy { | |||
241 | } | 242 | } |
242 | 243 | ||
243 | match self.ctor { | 244 | match self.ctor { |
244 | TypeCtor::Bool => write!(f, "bool")?, | 245 | TypeCtor::Scalar(Scalar::Bool) => write!(f, "bool")?, |
245 | TypeCtor::Char => write!(f, "char")?, | 246 | TypeCtor::Scalar(Scalar::Char) => write!(f, "char")?, |
246 | TypeCtor::Int(t) => write!(f, "{}", t)?, | 247 | TypeCtor::Scalar(Scalar::Float(t)) => { |
247 | TypeCtor::Float(t) => write!(f, "{}", t)?, | 248 | write!(f, "{}", primitive::float_ty_to_string(t))? |
249 | } | ||
250 | TypeCtor::Scalar(Scalar::Int(t)) => write!(f, "{}", primitive::int_ty_to_string(t))?, | ||
251 | TypeCtor::Scalar(Scalar::Uint(t)) => write!(f, "{}", primitive::uint_ty_to_string(t))?, | ||
248 | TypeCtor::Str => write!(f, "str")?, | 252 | TypeCtor::Str => write!(f, "str")?, |
249 | TypeCtor::Slice => { | 253 | TypeCtor::Slice => { |
250 | let t = self.parameters.as_single(); | 254 | let t = self.parameters.as_single(); |