]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Auto merge of #52990 - Aaron1011:fix/rustdoc-auto-trait-static, r=eddyb
authorbors <bors@rust-lang.org>
Mon, 6 Aug 2018 14:07:22 +0000 (14:07 +0000)
committerbors <bors@rust-lang.org>
Mon, 6 Aug 2018 14:07:22 +0000 (14:07 +0000)
commit4b8089daf8046d7999310d44e5c68ccff4ab255a
treed0af26b70ad7864085f4201d8399c4bcbfb682f1
parent78ec12df020453836c3b8990c0a8dd859b774e84
parentb010d1f9295821f2f37de76a84ea4e26620456dd
Auto merge of #52990 - Aaron1011:fix/rustdoc-auto-trait-static, r=eddyb

Fix ICE when rustdoc encounters certain usages of HRTBs

Fixes #51236

Under certain circumstances, `AutoTraitFinder` could end up computing a `ParamEnv` involving two trait predicates that differed only in the region parameters involved. One of these parameters would be a HRTB, while the other would be a normal region parameter.

When this `ParamEnv` was later passed to `SelectionContext`, an `Ambiguity` error would occur, since the erased versions of these predicates would be identical. To solve the issue, we de-duplicate our list of predicates as we build it up. Whenever we encounter two predicates that differ only in their assignment of region parameters (a HRTB vs a normal lifetime parameter), we pick the HRTB. This corresponds to selecting a 'stricter' bound to display in the generated documentation: we're requiring that a particular type works for all possible lifetime parameters if it's going to implement a particular auto trait.
src/librustdoc/clean/auto_trait.rs