Skip to content

Prevent "setting" inputs of tracked structs once exposed #320

Open
@nikomatsakis

Description

@nikomatsakis

You can set (which we may rename to override) the value of a tracked function for a tracked struct, if you created it:

#[tracked]
struct S { }

#[tracked]
fn foo(db: &dyn Db, s: S) -> u32 {
    23
}


#[tracked]
fn bar(db: &dyn Db) {
    let s = S::new(db);
    foo::set(db, s, 22);
}

This is cool, but we should prevent if it you have "exposed" the struct to another tracked function (which may have read this value...)

#[tracked]
struct S { }

#[tracked]
fn foo(db: &dyn Db, s: S) -> u32 {
    23
}

#[tracked]
fn bar(db: &dyn Db) {
    let s = S::new(db);
    baz(s);
    foo::set(db, s, 22);
}


#[tracked]
fn baz(db: &dyn Db, s: S) -> u32 {
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    salsa-2022Tracking issue for new salsa

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions