about summary refs log tree commit diff
path: root/src/test/rustdoc-ui/coverage/doc-examples.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2020-08-05 17:29:13 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2020-08-10 07:12:59 +1000
commit75b67c2d5e12d98b70323bd7874886dd650c5499 (patch)
tree62febac00e5ee2d4e9b0928d64333f54cae36cab /src/test/rustdoc-ui/coverage/doc-examples.rs
parent39e593ab14c53fda63c3f2756716c5ad3cbb6465 (diff)
downloadrust-75b67c2d5e12d98b70323bd7874886dd650c5499.tar.gz
rust-75b67c2d5e12d98b70323bd7874886dd650c5499.zip
Fix symbol ordering for confusable idents detection.
Confusable idents detection uses a type `BTreeMap<Symbol, Span>`. This is
highly dubious given that `Symbol` doesn't guarantee a meaningful order. (In
practice, it currently gives an order that mostly matches source code order.)

As a result, changes in `Symbol` representation make the
`lint-confusable-idents.rs` test fail, because this error message:

> identifier pair considered confusable between `s` and `s`

is changed to this:

> identifier pair considered confusable between `s` and `s`

and the corresponding span pointers get swapped erroneously, leading to
an incorrect "previous identifier" label.

This commit sorts the relevant symbols by span before doing the checking,
which ensures that the ident that appears first in the code will be mentioned
first in the message. The commit also extends the test slightly to be more
thorough.
Diffstat (limited to 'src/test/rustdoc-ui/coverage/doc-examples.rs')
0 files changed, 0 insertions, 0 deletions