Replace ~ with Box and box where appropriate

With this commit, the code compiles with the latest Rust version.
Merge branch 'tilde'