crates.sage_ir.checking.signature.body_independence

A checked signature is the body-independent cross-item interface. Consumers obtain the types, generic binder, and parameter environment needed to use a definition without checking that definition’s body. No signature query reads any function body. This is the signature-phase consequence of Cross-item dependencies stop at semantic interfaces.

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

Implementation

Implemented crates/sage-ir/src/check/sig.rs:57–62

sage_ir::check::sig · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.body_independence`
    pub fn complete_parameter_env(
        &mut self,
        where_clauses: sage_stash::Slice<WherePredicate<'db>>,
        solver_eligibility: SolverEligibility,
    ) -> CheckedParameterEnv<'db> {

}

See more source ↗

Implemented crates/sage-ir/src/check/trait_env.rs:49–54

sage_ir::check::trait_env · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.body_independence`
pub(crate) fn lower_predicates<'db>(
    cx: &mut Check<'_, 'db>,
    source_generics: Slice<GenericParamCst<'db>>,
    checked_generics: Slice<GenericParam<'db>>,
    where_clauses: Slice<WhereClauseCst<'db>>,

}

See more source ↗

Implemented crates/sage-ir/src/cst/generics.rs:110–115

sage_ir::cst::generics · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.body_independence`
impl<'db> CheckGenerics<'db> for Slice<GenericParamCst<'db>> {
    fn check(
        self,
        db: &'db dyn crate::Db,
        cx: &mut Check<'_, 'db>,

}

See more source ↗

Implemented crates/sage-ir/src/cst/ty.rs:103–108

sage_ir::cst::ty · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.body_independence`
    pub(crate) fn check(self, cx: &mut Check<'_, 'db>) -> Ty<'db> {
        let src = cx.source_stash;
        match self.kind {
            TypeCstKind::Path(path_ptr) => {
                let path = src[path_ptr];

}

See more source ↗

Implemented crates/sage-ir/src/external_syms.rs:402–407

sage_ir::external_syms · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.body_independence`
pub fn external_fn_signature<'db>(
    db: &'db dyn crate::Db,
    fn_sym: SymExt<'db>,
) -> Option<Stashed<Binder<'db, FnSig<'db>>>> {
    let raw = db

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/fns.rs:128–133

sage_ir::local_syms::fns · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.body_independence`
    // {anchor}`crates.sage_ir.checking.identity_minting`
    // {anchor}`crates.sage_ir.checking.signature.narrow_detail`
    pub fn sig(self, db: &'db dyn crate::Db) -> Stashed<Binder<'db, FnSig<'db>>> {
        use crate::check::Check;
        use crate::cst::fns::ReceiverCst;

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/impls.rs:127–132

sage_ir::local_syms::impls · lib:sage_ir

#![allow(unused)]
fn main() {
    // {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;
        use crate::resolve::Resolver;

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/traits.rs:45–50

sage_ir::local_syms::traits · lib:sage_ir

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

}

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_body_independence

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

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.checking.signature.body_independence)]
    fn checking_signature_body_independence() {
        // TODO: Complete the claim-specific verification matrix:
        // Query traces for local and external callers name the selected interface facts and no bodies; a
        // body-only edit preserves the signature result and does not reexecute its consumers.
    }
}

See more source ↗

Review: Accepted · macro_fix_precedence/body_independence.

Reviewed the complete body-independence claim, all eight ordinary implementation associations, and the sole associated TODO test. Additional function-CST and resolver source used to assess the boundary was captured. No production or test source changes were made.

The claim requires checked interfaces containing types, binders and parameter environments without checking the referenced definition body or reading function-body semantics. LocalFnSym::sig opens the function CST but traverses generics, owner interface, parameters/receiver, return type and predicates; it never dereferences cst.body or calls LocalFnSym::body. open_owner consumes trait/impl signatures, preserving owner generic parameters and predicates. The separate body query calls sig in the opposite direction. LocalTraitSym::sig constructs the Self binder and explicit generics, lowers header predicates and completeness, and does not traverse method bodies or associated item values. LocalImplSym::sig similarly lowers its self type, trait reference, generics and predicates without invoking associated method bodies. Associated-item enumeration is a separate operation.

CheckGenerics in cst/generics.rs mints/binds header parameter identities. TypeCst::check in cst/ty.rs recursively lowers declared type syntax, resolves identities and retains aliases; external ADT applications use declaration signatures/defaults and contribute their parameter environments rather than checking implementations. check/trait_env.rs lowers generic bounds and where clauses, references trait signatures for eligibility, and records explicit unsupported state when representation is incomplete. Check::complete_parameter_env combines declared and type-use predicates/eligibility into the interface. The captured resolver traverses symbols/imports and metadata and contains no function-body checking call; the new generated-root ambiguity audit does not introduce one.

external_fn_signature in external_syms.rs obtains RawFnSignature through the keyed metadata method and lower_fn_signature constructs a stash-owned binder with owner/method generics, receiver, argument/return types, parameter predicates and eligibility. Its lowering helpers translate raw declared types and definition identities; they do not request local bodies. This includes the changed external declaration metadata support in the captured file. Unsupported metadata remains flagged, not filled in by body checking.

Important boundary: LocalFnSym stores a combined FnCst containing a body pointer. Reading its tracked CST can therefore conservatively invalidate/reexecute a signature query after a body-only syntax edit, even though sig does not traverse the body. This source review does not claim the stronger property that the signature query never reexecutes after any body edit. The claimed body-independent result and consumer reuse require the explicit incremental verification below. No body-check dependency was found in the inspected query paths.

The sole test semantic_spec::todo::checking_signature_body_independence explicitly defers local/external query traces excluding bodies and a body-only edit preserving signature output and consumer reuse. That missing test matrix remains visible; no no-op test or passing unrelated compile test proves these negative-dependency/incremental guarantees. Completing it requires traces of selected interface queries, checking that body queries are absent, and controlled body edits followed by interface equality and consumer reexecution assertions. There are no N/A entries. This review executes start/read/record only and claims no new behavioral tests. All current implementation entries are accounted for, with the existing TODO preserving the empirical gap. No new required edits identified.

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