]> git.lizzy.rs Git - rust.git/commitdiff
Don't try to render auto-trait bounds with any inference variables
authorAaron Hill <aa1ronham@gmail.com>
Sun, 28 Apr 2019 00:33:03 +0000 (20:33 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Sun, 28 Apr 2019 00:33:03 +0000 (20:33 -0400)
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 #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.

src/librustc/traits/auto_trait.rs
src/librustdoc/clean/mod.rs

index e93351197fe4702c269de8bb3b21fdac02554dc7..03ce06a436415bcd109e303703277f2570bea239 100644 (file)
@@ -712,7 +712,7 @@ pub fn evaluate_nested_obligations<
                     // 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);
index 81e4905890d45c9c1f430bbeb973c04da667972e..27aec5197da876bfe2253ed0b42481d6872574b2 100644 (file)
@@ -2945,6 +2945,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Type {
 
 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),