]> git.lizzy.rs Git - rust.git/commit
don't make crazy suggestion for unreachable braced pub-use
authorZack M. Davis <code@zackmdavis.net>
Sun, 6 May 2018 05:14:33 +0000 (22:14 -0700)
committerZack M. Davis <code@zackmdavis.net>
Fri, 11 May 2018 03:48:18 +0000 (20:48 -0700)
commit7006018745566fae2f09f6fc201cf4f6de6a4414
tree3667fd037d8b331429a94f0ee289bb702355a8b0
parentacd3871ba17316419c644e17547887787628ec2f
don't make crazy suggestion for unreachable braced pub-use

The Higher Intermediate Representation doesn't have spans for visibility
keywords, so we were assuming that the first whitespace-delimited token
in the item span was the `pub` to be weakened. This doesn't work for
brace-grouped `use`s, which get lowered as if they were several
individual `use` statements, but with spans that only cover the braced
path-segments. Constructing a correct suggestion here presents some
challenges—until someone works those out, we can at least protect the
dignity of our compiler marking the suggestion for `use` items as
potentially incorrect.

This resolves #50455 (but again, it would be desirable in the future to
make a correct suggestion instead of copping out like this).
src/librustc_lint/builtin.rs
src/test/ui/lint/unreachable_pub-pub_crate.rs
src/test/ui/lint/unreachable_pub-pub_crate.stderr
src/test/ui/lint/unreachable_pub.rs
src/test/ui/lint/unreachable_pub.stderr