Fixes
This commit is contained in:
@@ -1574,7 +1574,6 @@ pub struct BuiltinType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BuiltinType {
|
impl BuiltinType {
|
||||||
// FIXME: I'm not sure if it's the best place to put it
|
|
||||||
pub fn str() -> BuiltinType {
|
pub fn str() -> BuiltinType {
|
||||||
BuiltinType { inner: hir_def::builtin_type::BuiltinType::Str }
|
BuiltinType { inner: hir_def::builtin_type::BuiltinType::Str }
|
||||||
}
|
}
|
||||||
@@ -2268,9 +2267,8 @@ impl Type {
|
|||||||
Type::new(db, krate, def, ty)
|
Type::new(db, krate, def, ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: No idea where to put it
|
pub fn new_slice(ty: Type) -> Type {
|
||||||
pub fn make_slice_of(self) -> Type {
|
Type { krate: ty.krate, env: ty.env, ty: TyBuilder::slice(ty.ty) }
|
||||||
Type { krate: self.krate, env: self.env, ty: TyBuilder::slice(self.ty) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_unit(&self) -> bool {
|
pub fn is_unit(&self) -> bool {
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ fn handle_as_ref_slice(
|
|||||||
famous_defs: &FamousDefs,
|
famous_defs: &FamousDefs,
|
||||||
) -> Option<ReferenceConversionType> {
|
) -> Option<ReferenceConversionType> {
|
||||||
let type_argument = ty.type_arguments().next()?;
|
let type_argument = ty.type_arguments().next()?;
|
||||||
let slice_type = type_argument.make_slice_of();
|
let slice_type = hir::Type::new_slice(type_argument);
|
||||||
|
|
||||||
ty.impls_trait(db, famous_defs.core_convert_AsRef()?, &[slice_type])
|
ty.impls_trait(db, famous_defs.core_convert_AsRef()?, &[slice_type])
|
||||||
.then(|| ReferenceConversionType::AsRefSlice)
|
.then(|| ReferenceConversionType::AsRefSlice)
|
||||||
|
|||||||
Reference in New Issue
Block a user