Get first inspect for non-Inspect-implementing opaques specialized

This commit is contained in:
Ayaz Hafiz 2023-09-12 12:11:36 -05:00 committed by Brendan Hansknecht
parent c87e3e7413
commit 5c805ce80f
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
6 changed files with 75 additions and 44 deletions

View file

@ -634,8 +634,17 @@ fn make_specialization_decision<P: Phase>(
};
match abilities_store.get_implementation(impl_key) {
None => {
// Doesn't specialize; an error will already be reported for this.
SpecializeDecision::Drop
match ability_member {
// Inspect is special - if there is no implementation for the
// opaque type, we always emit a default implementation.
Symbol::INSPECT_TO_INSPECTOR => SpecializeDecision::Specialize(
Immediate(Symbol::INSPECT_OPAQUE),
),
_ => {
// Doesn't specialize; an error will already be reported for this.
SpecializeDecision::Drop
}
}
}
Some(MemberImpl::Error) => {
// TODO: probably not right, we may want to choose a derive decision!