Prevent refcount cycles during linting

Shaves off ~600MB of memory while compiling rustc
auto merge of #6777 : alexcrichton/rust/less-memory, r=graydon

Via my super-accurate timing (`/usr/bin/time -l`), I get 2431119360 => 1884430336 == ~520MB

Closes #6637.