crates.sage_ir.checking.signature.owner_binder

Generic identities are minted once by their owner and reused. An owner signature creates its parameters under one binder. Associated-item, field, and body queries reopen that binder and add only genuinely new item-level parameters; they never reconstruct an existing GenericParam or owner Self identity.

Read in specification context · design/crates/sage_ir/checking.sage

Implementation

Implemented crates/sage-ir/src/cst/generics.rs:108–113

sage_ir::cst::generics · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.owner_binder`
// {anchor}`crates.sage_ir.checking.signature.storage`
// {anchor}`crates.sage_ir.checking.signature.body_independence`
impl<'db> CheckGenerics<'db> for Slice<GenericParamCst<'db>> {
    fn check(
        self,

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/associated.rs:31–36

sage_ir::local_syms::associated · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.owner_binder`
// {anchor}`crates.sage_ir.checking.signature.narrow_detail`
// {anchor}`crates.sage_ir.checking.symbol_keyed_interfaces`
pub(crate) fn lower_items<'db>(
    db: &'db dyn crate::Db,
    owner: LocalAssociatedOwner<'db>,

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/fns.rs:19–24

sage_ir::local_syms::fns · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.owner_binder`
// {anchor}`crates.sage_ir.checking.signature.storage`
fn open_owner<'db>(
    cx: &mut crate::check::Check<'_, 'db>,
    owner: Option<LocalAssociatedOwner<'db>>,
) -> OpenedOwner<'db> {

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/impls.rs:126–131

sage_ir::local_syms::impls · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.owner_binder`
    // {anchor}`crates.sage_ir.checking.signature.body_independence`
    // {anchor}`crates.sage_ir.checking.symbol_keyed_interfaces`
    pub fn sig(self, db: &'db dyn crate::Db) -> sage_stash::Stashed<crate::ty::ImplSignature<'db>> {
        use crate::check::Check;
        use crate::cst::generics::CheckGenerics;

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/structs.rs:51–56

sage_ir::local_syms::structs · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.owner_binder`
    pub fn sig(self, db: &'db dyn crate::Db) -> Stashed<Binder<'db, StructSig<'db>>> {
        use crate::check::Check;
        use crate::cst::generics::CheckGenerics;
        use crate::resolve::Resolver;
        use crate::symbol::Symbol;

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/traits.rs:44–49

sage_ir::local_syms::traits · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.owner_binder`
    // {anchor}`crates.sage_ir.checking.signature.body_independence`
    pub fn sig(
        self,
        db: &'db dyn crate::Db,
    ) -> sage_stash::Stashed<crate::ty::TraitSignature<'db>> {

}

See more source ↗

Tests and review

Indexed tests and the implementation-completeness and test-adequacy review; no test run is implied.

TODO sage_meta::todo::checking_signature_owner_binder

crates/sage-meta/tests/semantic_spec.rs · test:semantic_spec

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.checking.signature.owner_binder)]
    fn checking_signature_owner_binder() {
        // TODO: Complete the claim-specific verification matrix:
        // Trait, impl, associated-function, field, and body fixtures compare semantic parameter
        // identities across queries and revisions, including separate owner and method generic scopes.
    }
}

See more source ↗

Implemented sage_test_harness::trait_system_tests::trait_and_impl_signatures_share_complete_generic_binders

crates/sage-test-harness/src/lib.rs · lib:sage_test_harness

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.types.binder.owner_parameters)]
    #[sage::test(crates.sage_ir.checking.signature.owner_binder)]
    fn trait_and_impl_signatures_share_complete_generic_binders() {
        with_test_crate(
            "trait Bound {}\ntrait PairBound<T> where T: Bound {}\nimpl<T: Bound> PairBound<T> for (T, T) {}",
            |db, root| {
                let items = root.expanded_module_items(db);
                let pair_trait = items
                    .iter()
                    .find_map(|symbol| match symbol.data(db) {
                        SymbolData::TraitSymbol(TraitSymbol::Local(local))
                            if local.name(db).text(db) == "PairBound" =>
                        {
                            Some(local)
                        }
                        _ => None,
                    })
                    .unwrap();
                let signature = pair_trait.sig(db);
                let (stash, binder) = signature.open();
                assert_eq!(stash[binder.generics].len(), 2); // Self, T
                assert_eq!(binder.value.solver_eligibility, SolverEligibility::Eligible);
                assert_eq!(stash[binder.value.where_clauses].len(), 1);

                let ScopeSymbol::Crate(krate) = pair_trait.scope(db) else {
                    panic!("root item should be crate-scoped")
                };
                let impls = local_impls(db, krate);
                assert_eq!(impls.len(), 1);
                let impl_signature = impls[0].sig(db);
                let (stash, binder) = impl_signature.open();
                assert_eq!(stash[binder.generics].len(), 1);
                assert_eq!(binder.value.solver_eligibility, SolverEligibility::Eligible);
                let Ty::Tuple(elements) = stash[binder.value.self_ty] else {
                    panic!("expected tuple impl self type")
                };
                let elements = &stash[elements];
                assert_eq!(elements.len(), 2);
                assert_eq!(stash[elements[0]], stash[elements[1]]);
            },
        );
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Review: Accepted · Codex /root/final_quality.

Reviewed the complete owner_binder claim, all six ordinary implementation associations, and both associated tests (one ordinary, one TODO). The requirements are owner-only parameter minting under a binder, reuse by associated-item/field/body queries, creation only of new item-level parameters, and preservation of owner GenericParam and Self identities.

Implementation inspection: CheckGenerics in cst/generics.rs creates parameters using the owning Symbol and parameter index, registers exactly those handles and returns their slice. Struct and impl sig methods call it at their tracked owner signature boundary and return the resulting binder. Trait sig creates explicit parameters and one implicit Self parameter owned by the trait, then returns Self followed by the explicit parameters. fns.rs open_owner copies that trait binder, deriving the Self type from binder.value.self_param; for impl owners it copies the existing self type and binder. LocalFnSym::sig registers these owner parameters and calls CheckGenerics only for the function's own declaration, concatenating owner and method slices with owner_generic_count. associated::lower_items accepts owner generics and copies those handles into its item-list binder; trait/impl items callers supply sig().iter_symbols(). Struct fields also use sig().iter_symbols(). LocalFnSym::body obtains sig, registers its parameters, and imports its Self/type/environment values, without calling the minting helper.

Captured generic_param.rs confirms parent/kind/name/index identity fields and tracked source span. Captured Binder/BinderExt code copies semantic handles and iterates the existing generic slice; ribs stores Resolution::Param(gp) directly, and captured import_fn_sig copies owner Self and signature types into body storage without constructing GenericParam. These support the ordinary owner-reopening paths. Associated type aliases/constants have no complete signature API yet: captured existing ty.rs TODOs explicitly require those APIs to reopen owner binders and defer their identity-preservation coverage. This report does not invent completed support for those absent operations or equate a symbol-only enumeration with checking such a signature.

Ordinary test trait_and_impl_signatures_share_complete_generic_binders uses actual Rust source defining Bound, PairBound<T>, and an impl for (T,T). Captured with_test_crate setup adds source files, creates a tracked root, parses source and invokes real queries. Visible assertions check two trait parameters (Self and T), eligible trait signature and one predicate; one impl and one impl parameter, eligible impl signature, two tuple elements and equal checked element types. This is meaningful binder-shape and repeated-parameter-use coverage. It does not explicitly compare the trait Self handle with its binder entry, compare an impl element's handle with binder.generics[0], exercise associated functions/fields/bodies, or edit a persistent database. It is therefore not presented as proof of the whole identity contract.

The associated TODO checking_signature_owner_binder explicitly reserves trait/impl/associated-function/field/body identity comparisons across queries and revisions, including separate owner and method scopes. It has no assertions and remains deferred. Completing it requires source-backed consumers exposing the actual parameter handles from each product, persistent database revisions, and assertions that owner handles are reused while item-local handles stay distinct. Missing associated type/constant signature APIs are a prerequisite for those kinds, as documented by the captured implementation TODO. Together the ordinary test's limited assertions and explicit outstanding matrix honestly account for the claim without claiming complete verification.

Commands executed: fresh cargo meta review start with coordinator instructions; source and complete-test inspection; review read captures for checking design, generic identity definitions, binder/ribs/import helpers, test fixture/root construction, and existing missing-API TODOs. No tests or build were run by this reviewer; central suite execution remains separate evidence. No source changes or new suspected defect requiring reproduction. No requested edits; existing deferred implementation and verification are retained explicitly.

Browse crates anchors

139 anchors

Specification anchors and declared coverage
AnchorImplementationTests
crates (139)114 Implemented37 TODO2 N/A74 Implemented107 TODO
crates.sage_inspector (15)13 Implemented1 TODO2 N/A3 Implemented15 TODO
crates.sage_inspector.inspection (15)13 Implemented1 TODO2 N/A3 Implemented15 TODO
balanced_tracesImplementedTODO
canonical_ownershipImplementedImplementedTODO
derive_reflectionImplementedImplementedTODO
detail_free_indexImplementedTODO
deterministic_traceImplementedTODO
durable_navigationN/ATODO
generic_browserN/ATODO
owned_reflectionImplementedImplementedTODO
product_availabilityImplementedTODO
revision_and_demandImplementedTODO
semantic_phase_boundaryImplementedTODO
source_evidenceImplementedTODO
typed_serviceImplementedTODO
unknown_workImplementedTODOTODO
workspace_actorImplementedTODO
crates.sage_ir (90)67 Implemented34 TODO40 Implemented88 TODO
crates.sage_ir.checking (12)12 Implemented3 TODO5 Implemented12 TODO
crates.sage_ir.checking.body (5)5 Implemented2 TODO3 Implemented5 TODO
elaborationImplementedImplementedTODO
expected_typesImplementedTODOTODO
interface_dependenciesImplementedImplementedTODO
isolated_completionImplementedImplementedTODO
operator_callsImplementedTODOTODO
identity_mintingImplementedTODO
owned_productsImplementedImplementedTODO
crates.sage_ir.checking.signature (4)4 Implemented1 TODO1 Implemented4 TODO
body_independenceImplementedTODO
narrow_detailImplementedTODOTODO
owner_binderImplementedImplementedTODO
storageImplementedTODO
symbol_keyed_interfacesImplementedTODO
crates.sage_ir.crate (9)9 TODO9 TODO
explicit_restrictionsTODOTODO
identity_before_detailTODOTODO
incremental_evidenceTODOTODO
narrow_demandsTODOTODO
reexecution_and_invalidationTODOTODO
represented_completenessTODOTODO
restrictions_and_gapsTODOTODO
semantic_query_boundariesTODOTODO
terminal_incompletenessTODOTODO
crates.sage_ir.inference (8)8 Implemented6 Implemented8 TODO
atomic_checkingImplementedImplementedTODO
body_local_quiescenceImplementedImplementedTODO
canonical_boundaryImplementedImplementedTODO
completed_body_boundaryImplementedTODO
numeric_domainsImplementedImplementedTODO
subtyping_and_coercionImplementedImplementedTODO
terminal_obligationsImplementedTODO
transaction_isolationImplementedImplementedTODO
crates.sage_ir.metadata (4)4 Implemented1 TODO4 TODO
explicit_incompletenessImplementedTODO
keyed_reuseImplementedTODOTODO
product_boundariesImplementedTODO
provider_authorityImplementedTODO
crates.sage_ir.modules (8)7 Implemented1 TODO4 Implemented8 TODO
crates.sage_ir.modules.expand (4)4 Implemented2 Implemented4 TODO
completenessImplementedImplementedTODO
dependenciesImplementedTODO
direct_membersImplementedTODO
recursion_and_fixpointImplementedImplementedTODO
crates.sage_ir.modules.parse (4)3 Implemented1 TODO2 Implemented4 TODO
dependenciesImplementedTODO
detail_firewallImplementedImplementedTODO
recovery_completenessTODOTODO
syntax_identitiesImplementedImplementedTODO
crates.sage_ir.resolution (5)5 Implemented1 TODO3 Implemented4 TODO
crates.sage_ir.resolution.lookup (5)5 Implemented1 TODO3 Implemented4 TODO
completenessImplementedTODOImplementedTODO
dependenciesImplementedTODO
expansion_import_ambiguityImplementedImplemented
identity_onlyImplementedTODO
precedenceImplementedImplementedTODO
crates.sage_ir.solver (9)7 Implemented7 TODO5 Implemented9 TODO
alternative_isolationImplementedTODOImplementedTODO
bounded_completenessImplementedTODOTODO
candidate_completenessImplementedTODO
canonical_cyclesTODOTODO
canonical_outputsImplementedImplementedTODO
local_index_firewallTODOTODO
normalization_demandImplementedTODOImplementedTODO
schedule_independenceImplementedTODOImplementedTODO
shared_final_resultImplementedTODOImplementedTODO
crates.sage_ir.symbols (8)8 Implemented4 Implemented7 TODO
associated_identityImplementedImplemented
associated_interfacesImplementedTODO
body_interfacesImplementedImplementedTODO
definition_identityImplementedTODO
external_fact_queriesImplementedTODO
external_identityImplementedTODO
kind_wrappersImplementedImplementedTODO
local_identityImplementedImplementedTODO
crates.sage_ir.types (27)16 Implemented12 TODO13 Implemented27 TODO
crates.sage_ir.types.aliases (2)1 Implemented1 TODO1 Implemented2 TODO
identityImplementedImplementedTODO
revelationTODOTODO
crates.sage_ir.types.binder (1)1 Implemented1 TODO1 Implemented1 TODO
owner_parametersImplementedTODOImplementedTODO
crates.sage_ir.types.body (13)4 Implemented9 TODO3 Implemented13 TODO
awaitTODOTODO
closuresTODOTODO
conditional_patternsTODOTODO
coroutinesTODOTODO
diagnosed_recoveryImplementedImplementedTODO
elaboratedTODOImplementedTODO
for_iterationTODOTODO
indexingTODOTODO
macro_expansionTODOTODO
no_inferenceImplementedImplementedTODO
resolved_referencesImplementedTODO
try_residualTODOTODO
typed_provenanceImplementedTODO
crates.sage_ir.types.calls (2)1 Implemented1 TODO1 Implemented2 TODO
dispatch_familiesTODOTODO
selected_semanticsImplementedImplementedTODO
crates.sage_ir.types.lifetimes (2)2 Implemented2 Implemented2 TODO
dummyImplementedImplementedTODO
unchecked_borrowsImplementedImplementedTODO
crates.sage_ir.types.operators (2)2 Implemented1 Implemented2 TODO
lazy_control_flowImplementedTODO
trait_callsImplementedImplementedTODO
scoped_identitiesImplementedTODO
crates.sage_ir.types.spans (4)4 Implemented4 Implemented4 TODO
generated_identityImplementedImplementedTODO
item_originImplementedImplementedTODO
offset_reuseImplementedImplementedTODO
relative_compositionImplementedImplementedTODO
crates.sage_oracle_harness (4)4 Implemented2 TODO1 Implemented4 TODO
crates.sage_oracle_harness.crate (4)4 Implemented2 TODO1 Implemented4 TODO
deterministic_emissionImplementedTODO
exact_comparisonImplementedTODOImplementedTODO
fixed_projectionImplementedTODO
independent_coverageImplementedTODOTODO
crates.sage_stash (5)5 Implemented5 Implemented
crates.sage_stash.storage (5)5 Implemented5 Implemented
handle_ownershipImplementedImplemented
immutable_entriesImplementedImplemented
query_valueImplementedImplemented
rooted_equalityImplementedImplemented
typed_interningImplementedImplemented
crates.sage_test_harness (25)25 Implemented25 Implemented
crates.sage_test_harness.compile_tests (25)25 Implemented25 Implemented
annotation_validationImplementedImplemented
blessing_gateImplementedImplemented
callsite_updatesImplementedImplemented
checking_scopeImplementedImplemented
compiler_conditionsImplementedImplemented
completed_typesImplementedImplemented
coordinatesImplementedImplemented
dependenciesImplementedImplemented
diagnostic_countsImplementedImplemented
diagnostic_locationsImplementedImplemented
editionImplementedImplemented
fixturesImplementedImplemented
grouped_observationsImplementedImplemented
invocationImplementedImplemented
production_executionImplementedImplemented
project_isolationImplementedImplemented
query_captureImplementedImplemented
query_projectionImplementedImplemented
renderingImplementedImplemented
resolved_symbolsImplementedImplemented
review_visibilityImplementedImplemented
rustc_executionImplementedImplemented
rustc_lintsImplementedImplemented
starting_expressionsImplementedImplemented
target_lineImplementedImplemented