Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/opaques.rs')
-rw-r--r--crates/hir-ty/src/opaques.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/crates/hir-ty/src/opaques.rs b/crates/hir-ty/src/opaques.rs
index 699b6307dc..86baa64895 100644
--- a/crates/hir-ty/src/opaques.rs
+++ b/crates/hir-ty/src/opaques.rs
@@ -10,7 +10,7 @@ use rustc_type_ir::inherent::Ty as _;
use syntax::ast;
use crate::{
- ImplTraitId, InferenceResult, Span,
+ ImplTraitId, InferBodyId, InferenceResult, Span,
db::{HirDatabase, InternedOpaqueTyId},
lower::{ImplTraitIdx, ImplTraits},
next_solver::{
@@ -22,10 +22,10 @@ use crate::{
pub(crate) fn opaque_types_defined_by(
db: &dyn HirDatabase,
- def_id: DefWithBodyId,
+ def_id: InferBodyId,
result: &mut Vec<SolverDefId>,
) {
- if let DefWithBodyId::FunctionId(func) = def_id {
+ if let Some(func) = def_id.as_function() {
// A function may define its own RPITs.
extend_with_opaques(
db,
@@ -66,9 +66,15 @@ pub(crate) fn opaque_types_defined_by(
_ => {}
};
match def_id {
- DefWithBodyId::ConstId(id) => extend_with_atpit_from_container(id.loc(db).container),
- DefWithBodyId::FunctionId(id) => extend_with_atpit_from_container(id.loc(db).container),
- DefWithBodyId::StaticId(_) | DefWithBodyId::VariantId(_) => {}
+ InferBodyId::DefWithBodyId(DefWithBodyId::ConstId(id)) => {
+ extend_with_atpit_from_container(id.loc(db).container)
+ }
+ InferBodyId::DefWithBodyId(DefWithBodyId::FunctionId(id)) => {
+ extend_with_atpit_from_container(id.loc(db).container)
+ }
+ InferBodyId::DefWithBodyId(DefWithBodyId::StaticId(_))
+ | InferBodyId::DefWithBodyId(DefWithBodyId::VariantId(_))
+ | InferBodyId::AnonConstId(_) => {}
}
// FIXME: Collect opaques from `#[define_opaque]`.