about summary refs log tree commit diff
path: root/src/test/rustdoc-ui
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2021-09-02 09:54:32 -0700
committerNoah Lev <camelidcamel@gmail.com>2021-09-02 14:28:10 -0700
commit3a3f99a79b00b5efcb1bf061404112a281084b97 (patch)
treef82ffa2ceb43add67ffe692a0f2bf69b06ab8d97 /src/test/rustdoc-ui
parent2a6022949077176bfff9f72282dc52e51a175cb7 (diff)
downloadrust-3a3f99a79b00b5efcb1bf061404112a281084b97.tar.gz
rust-3a3f99a79b00b5efcb1bf061404112a281084b97.zip
rustdoc: Higher-ranked lifetimes can't have bounds
This cleans up the other spot I found where rustdoc was rendering bounds
into the lifetime name itself. However, in this case, I don't think it
could have actually happened because higher-ranked lifetime definitions
aren't currently allowed to have bounds.
Diffstat (limited to 'src/test/rustdoc-ui')
-rw-r--r--src/test/rustdoc-ui/bounded-hr-lifetime.rs9
-rw-r--r--src/test/rustdoc-ui/bounded-hr-lifetime.stderr10
2 files changed, 19 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/bounded-hr-lifetime.rs b/src/test/rustdoc-ui/bounded-hr-lifetime.rs
new file mode 100644
index 00000000000..b2e000b9757
--- /dev/null
+++ b/src/test/rustdoc-ui/bounded-hr-lifetime.rs
@@ -0,0 +1,9 @@
+// This test ensures that rustdoc doesn't panic on higher-ranked lifetimes
+// with bounds, because an error should have already been emitted by rustc.
+
+pub fn hrlt<'b, 'c>()
+where
+    for<'a: 'b + 'c> &'a (): std::fmt::Debug,
+    //~^ ERROR lifetime bounds cannot be used in this context
+{
+}
diff --git a/src/test/rustdoc-ui/bounded-hr-lifetime.stderr b/src/test/rustdoc-ui/bounded-hr-lifetime.stderr
new file mode 100644
index 00000000000..d8fcd6cb4b1
--- /dev/null
+++ b/src/test/rustdoc-ui/bounded-hr-lifetime.stderr
@@ -0,0 +1,10 @@
+error: lifetime bounds cannot be used in this context
+  --> $DIR/bounded-hr-lifetime.rs:6:13
+   |
+LL |     for<'a: 'b + 'c> &'a (): std::fmt::Debug,
+   |             ^^   ^^
+
+error: Compilation failed, aborting rustdoc
+
+error: aborting due to 2 previous errors
+