Functional languages, along with Rust's linear type-system, can ensure this for single-ownership structures (trees, singly-linked lists), but not for structures with more complex ownership, like doubly-linked lists. The unpopular languages I was talking about were Agda and friends.