Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-ty/src/db.rs15
-rw-r--r--crates/hir-ty/src/layout/target.rs2
-rw-r--r--crates/hir-ty/src/mir/borrowck.rs7
-rw-r--r--crates/hir-ty/src/mir/lower.rs4
-rw-r--r--crates/hir-ty/src/mir/monomorphization.rs4
-rw-r--r--crates/hir/src/lib.rs2
6 files changed, 15 insertions, 19 deletions
diff --git a/crates/hir-ty/src/db.rs b/crates/hir-ty/src/db.rs
index 6058157143..028694cd94 100644
--- a/crates/hir-ty/src/db.rs
+++ b/crates/hir-ty/src/db.rs
@@ -40,16 +40,16 @@ use crate::{
pub trait HirDatabase: SourceDatabase + std::fmt::Debug {
// region:mir
- // FXME: Collapse `mir_body_for_closure` into `mir_body`
+ // FIXME: Collapse `mir_body_for_closure` into `mir_body`
// and `monomorphized_mir_body_for_closure` into `monomorphized_mir_body`
#[salsa::transparent]
fn mir_body(&self, def: InferBodyId) -> Result<&MirBody, MirLowerError> {
- crate::mir::mir_body_query(self, def).as_ref().map_err(|err| err.clone())
+ crate::mir::mir_body_query(self, def).map_err(|err| err.clone())
}
#[salsa::transparent]
fn mir_body_for_closure(&self, def: InternedClosureId) -> Result<&MirBody, MirLowerError> {
- crate::mir::mir_body_for_closure_query(self, def).as_ref().map_err(|err| err.clone())
+ crate::mir::mir_body_for_closure_query(self, def).map_err(|err| err.clone())
}
#[salsa::transparent]
@@ -59,9 +59,7 @@ pub trait HirDatabase: SourceDatabase + std::fmt::Debug {
subst: StoredGenericArgs,
env: StoredParamEnvAndCrate,
) -> Result<&MirBody, MirLowerError> {
- crate::mir::monomorphized_mir_body_query(self, def, subst, env)
- .as_ref()
- .map_err(|err| err.clone())
+ crate::mir::monomorphized_mir_body_query(self, def, subst, env).map_err(|err| err.clone())
}
#[salsa::transparent]
@@ -72,13 +70,12 @@ pub trait HirDatabase: SourceDatabase + std::fmt::Debug {
env: StoredParamEnvAndCrate,
) -> Result<&MirBody, MirLowerError> {
crate::mir::monomorphized_mir_body_for_closure_query(self, def, subst, env)
- .as_ref()
.map_err(|err| err.clone())
}
#[salsa::transparent]
fn borrowck(&self, def: InferBodyId) -> Result<&[BorrowckResult], MirLowerError> {
- crate::mir::borrowck_query(self, def).as_ref().map(|it| &**it).map_err(|err| err.clone())
+ crate::mir::borrowck_query(self, def).map_err(|err| err.clone())
}
#[salsa::invoke(crate::consteval::const_eval)]
@@ -137,7 +134,7 @@ pub trait HirDatabase: SourceDatabase + std::fmt::Debug {
#[salsa::transparent]
fn target_data_layout(&self, krate: Crate) -> Result<&TargetDataLayout, TargetLoadError> {
- crate::layout::target_data_layout_query(self, krate).as_ref().map_err(|err| err.clone())
+ crate::layout::target_data_layout_query(self, krate).map_err(|err| err.clone())
}
#[salsa::invoke(crate::dyn_compatibility::dyn_compatibility_of_trait_query)]
diff --git a/crates/hir-ty/src/layout/target.rs b/crates/hir-ty/src/layout/target.rs
index 26fa73e76b..cf92c18f8c 100644
--- a/crates/hir-ty/src/layout/target.rs
+++ b/crates/hir-ty/src/layout/target.rs
@@ -6,7 +6,7 @@ use rustc_abi::{AddressSpace, AlignFromBytesError, TargetDataLayoutError};
use crate::db::HirDatabase;
-#[salsa_macros::tracked(returns(ref))]
+#[salsa_macros::tracked(returns(as_ref))]
pub fn target_data_layout_query(
db: &dyn HirDatabase,
krate: Crate,
diff --git a/crates/hir-ty/src/mir/borrowck.rs b/crates/hir-ty/src/mir/borrowck.rs
index c5367f630e..31a75d6ab0 100644
--- a/crates/hir-ty/src/mir/borrowck.rs
+++ b/crates/hir-ty/src/mir/borrowck.rs
@@ -133,7 +133,7 @@ fn all_mir_bodies<'db>(
}
}
-#[salsa_macros::tracked(returns(ref), lru = 2024)]
+#[salsa_macros::tracked(returns(as_deref), lru = 2024)]
pub fn borrowck_query(
db: &dyn HirDatabase,
def: InferBodyId,
@@ -144,7 +144,7 @@ pub fn borrowck_query(
let env = db.trait_environment(def.generic_def(db));
// This calculates opaques defining scope which is a bit costly therefore is put outside `all_mir_bodies()`.
let typing_mode = TypingMode::borrowck(interner, def.into());
- let res = all_mir_bodies(
+ all_mir_bodies(
db,
def,
|body, owner| {
@@ -184,8 +184,7 @@ pub fn borrowck_query(
}
}
},
- )?;
- Ok(res)
+ )
}
fn moved_out_of_ref<'db>(
diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs
index 17843da98b..8cc59ecd0c 100644
--- a/crates/hir-ty/src/mir/lower.rs
+++ b/crates/hir-ty/src/mir/lower.rs
@@ -2123,7 +2123,7 @@ fn cast_kind<'db>(
})
}
-#[salsa_macros::tracked(returns(ref), cycle_result = mir_body_for_closure_cycle_result)]
+#[salsa_macros::tracked(returns(as_ref), cycle_result = mir_body_for_closure_cycle_result)]
pub fn mir_body_for_closure_query<'db>(
db: &'db dyn HirDatabase,
closure: InternedClosureId,
@@ -2282,7 +2282,7 @@ pub fn mir_body_for_closure_query<'db>(
Ok(ctx.result)
}
-#[salsa_macros::tracked(returns(ref), cycle_result = mir_body_cycle_result)]
+#[salsa_macros::tracked(returns(as_ref), cycle_result = mir_body_cycle_result)]
pub fn mir_body_query<'db>(db: &'db dyn HirDatabase, def: InferBodyId) -> Result<'db, MirBody> {
let krate = def.krate(db);
let edition = krate.data(db).edition;
diff --git a/crates/hir-ty/src/mir/monomorphization.rs b/crates/hir-ty/src/mir/monomorphization.rs
index 06871a3f18..bcc86ba4bf 100644
--- a/crates/hir-ty/src/mir/monomorphization.rs
+++ b/crates/hir-ty/src/mir/monomorphization.rs
@@ -238,7 +238,7 @@ impl<'db> Filler<'db> {
}
}
-#[salsa_macros::tracked(returns(ref), cycle_result = monomorphized_mir_body_cycle_result)]
+#[salsa_macros::tracked(returns(as_ref), cycle_result = monomorphized_mir_body_cycle_result)]
pub fn monomorphized_mir_body_query(
db: &dyn HirDatabase,
owner: InferBodyId,
@@ -262,7 +262,7 @@ fn monomorphized_mir_body_cycle_result(
Err(MirLowerError::Loop)
}
-#[salsa_macros::tracked(returns(ref), cycle_result = monomorphized_mir_body_for_closure_cycle_result)]
+#[salsa_macros::tracked(returns(as_ref), cycle_result = monomorphized_mir_body_for_closure_cycle_result)]
pub fn monomorphized_mir_body_for_closure_query(
db: &dyn HirDatabase,
closure: InternedClosureId,
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index ad1a9c9072..4beb7e9033 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -2101,7 +2101,7 @@ impl DefWithBody {
}
if let Ok(borrowck_results) = db.borrowck(id.into()) {
- for borrowck_result in borrowck_results.iter() {
+ for borrowck_result in borrowck_results {
let mir_body = borrowck_result.mir_body(db);
for moof in &borrowck_result.moved_out_of_ref {
let span: InFile<SyntaxNodePtr> = match moof.span {