]> git.lizzy.rs Git - rust.git/commitdiff
Fix rustdoc crash when 'static bound appears in struct declaration
authorAaron Hill <aa1ronham@gmail.com>
Sat, 23 Jun 2018 02:25:56 +0000 (22:25 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Thu, 2 Aug 2018 13:58:44 +0000 (09:58 -0400)
src/librustdoc/clean/auto_trait.rs
src/test/rustdoc/synthetic_auto/static-region.rs [new file with mode: 0644]

index c30d6817b466404d89e5c75c32f5558522dc4dd7..69f2ac5bd662efb775098bc3b8e97790d84ddd95 100644 (file)
@@ -642,8 +642,8 @@ fn extract_for_generics<'b, 'c, 'd>(
                                 name: name.to_string(),
                                 kind: GenericParamDefKind::Lifetime,
                             })
-                        }
-                        &ty::ReVar(_) | &ty::ReEarlyBound(_) => None,
+                        },
+                        &ty::ReVar(_) | &ty::ReEarlyBound(_) | &ty::ReStatic => None,
                         _ => panic!("Unexpected region type {:?}", r),
                     }
                 })
diff --git a/src/test/rustdoc/synthetic_auto/static-region.rs b/src/test/rustdoc/synthetic_auto/static-region.rs
new file mode 100644 (file)
index 0000000..96e8b8e
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait OwnedTrait<'a> {
+    type Reader;
+}
+
+// @has static_region/struct.Owned.html
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<T> Send for \
+// Owned<T> where <T as OwnedTrait<'static>>::Reader: Send"
+pub struct Owned<T> where T: OwnedTrait<'static> {
+    marker: <T as OwnedTrait<'static>>::Reader,
+}