Remix.run Logo
steveklabnik 4 hours ago

Rust has affine types, not linear. It also doesn't have mutable value semantics, it uses references, lifetimes, and borrowing.

EnPissant 4 hours ago | parent [-]

I've never seen any significant difference in linear vs affine types.

To me it just seems like Rust has Linear types, and the compiler just inserts some code to destroy your values for you if you don't do it yourself.

I guess the only difference is that linear types can _force_ you to manually consume a value (not necessarily via drop)? Is that what you are going for?

steveklabnik 4 hours ago | parent [-]

Affine types are "may use" and linear types are "must use," yeah. That is, linear types are stronger.

See https://faultlore.com/blah/linear-rust/ for a (now pretty old but still pretty relevant, I think) exploration into what linear types would mean for Rust.