From 7072f59fc61b8b487f301df1fe5eefbcc84672aa Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 1 Mar 2021 19:30:34 +0100 Subject: Use chalk_ir::Mutability --- crates/hir/src/code_model.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crates/hir') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 00b0dc082..fc1a74641 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -14,7 +14,7 @@ use hir_def::{ per_ns::PerNs, resolver::{HasResolver, Resolver}, src::HasSource as _, - type_ref::{Mutability, TypeRef}, + type_ref::TypeRef, AdtId, AssocContainerId, AssocItemId, AssocItemLoc, AttrDefId, ConstId, ConstParamId, DefWithBodyId, EnumId, FunctionId, GenericDefId, HasModule, ImplId, LifetimeParamId, LocalEnumVariantId, LocalFieldId, Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, @@ -32,8 +32,8 @@ use hir_ty::{ method_resolution, traits::{FnTrait, Solution, SolutionVariables}, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate, - InEnvironment, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substs, TraitEnvironment, - Ty, TyDefId, TyVariableKind, + InEnvironment, Mutability, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substs, + TraitEnvironment, Ty, TyDefId, TyVariableKind, }; use rustc_hash::FxHashSet; use stdx::{format_to, impl_from}; @@ -836,7 +836,7 @@ pub enum Access { impl From for Access { fn from(mutability: Mutability) -> Access { match mutability { - Mutability::Shared => Access::Shared, + Mutability::Not => Access::Shared, Mutability::Mut => Access::Exclusive, } } @@ -865,7 +865,10 @@ impl SelfParam { .params .first() .map(|param| match *param { - TypeRef::Reference(.., mutability) => mutability.into(), + TypeRef::Reference(.., mutability) => match mutability { + hir_def::type_ref::Mutability::Shared => Access::Shared, + hir_def::type_ref::Mutability::Mut => Access::Exclusive, + }, _ => Access::Owned, }) .unwrap_or(Access::Owned) -- cgit v1.2.3