Skip to content

Commit

Permalink
Don't try to render auto-trait bounds with any inference variables
Browse files Browse the repository at this point in the history
Previously, we checked if the target of a projection type was itself an
inference variable. However, for Rustdoc rendering purposes, there's no
distinction between an inference variable ('_') and a type containing
one (e.g. (MyStruct<u8, _>)) - we don't want to render either of them.

Fixes rust-lang#60269

Due to the complexity of the original bug, which spans three different
crates (hyper, tower-hyper, and tower), I have been unable to create a
minimized reproduction for the issue.
  • Loading branch information
Aaron1011 committed Apr 28, 2019
1 parent ab9c016 commit 02a40e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
// Additionally, we check if we've seen this predicate before,
// to avoid rendering duplicate bounds to the user.
if self.is_param_no_infer(p.skip_binder().projection_ty.substs)
&& !p.ty().skip_binder().is_ty_infer()
&& !p.ty().skip_binder().has_infer_types()
&& is_new_pred {
debug!("evaluate_nested_obligations: adding projection predicate\
to computed_preds: {:?}", predicate);
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2945,6 +2945,7 @@ impl Clean<Type> for hir::Ty {

impl<'tcx> Clean<Type> for Ty<'tcx> {
fn clean(&self, cx: &DocContext<'_>) -> Type {
debug!("cleaning type: {:?}", self);
match self.sty {
ty::Never => Never,
ty::Bool => Primitive(PrimitiveType::Bool),
Expand Down

0 comments on commit 02a40e8

Please sign in to comment.