https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122443
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- It depends what you do in the walk_tree_1, the function in itself should not cause any duplication. But if you unshare from within a walk you can get into "recursive unsharing". I think the "deep unsharing" with TREE_VISITED pre-set will essentially use a single mostly_copy_tree_r which in turn will unshare shared expressions, in case the rust frontend built any of those. You might want to debug this with a much smaller example though.
