about summary refs log tree commit diff
path: root/tests/rustdoc/inline_cross
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2023-10-03 17:16:51 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2023-10-03 17:16:51 +0200
commit67de1509f394414c2987af32a952a6fe66ad815a (patch)
tree87fc328f283ebabc15c8a90e5584834cb6edc5a8 /tests/rustdoc/inline_cross
parent085acd02d4abaf2ccaf629134caa83cfe23283c8 (diff)
downloadrust-67de1509f394414c2987af32a952a6fe66ad815a.tar.gz
rust-67de1509f394414c2987af32a952a6fe66ad815a.zip
rustdoc: fix & clean up handling of cross-crate higher-ranked lifetimes
Diffstat (limited to 'tests/rustdoc/inline_cross')
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/fn-type.rs1
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs2
-rw-r--r--tests/rustdoc/inline_cross/fn-type.rs12
-rw-r--r--tests/rustdoc/inline_cross/impl_trait.rs2
4 files changed, 15 insertions, 2 deletions
diff --git a/tests/rustdoc/inline_cross/auxiliary/fn-type.rs b/tests/rustdoc/inline_cross/auxiliary/fn-type.rs
new file mode 100644
index 00000000000..dacda516bb8
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/fn-type.rs
@@ -0,0 +1 @@
+pub type F = for<'z, 'a, '_unused> fn(&'z for<'b> fn(&'b str), &'a ()) -> &'a ();
diff --git a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
index 42cfc3dc319..fa61312ebc8 100644
--- a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
@@ -15,7 +15,7 @@ pub fn func4<T: Iterator<Item = impl Clone>>(_x: T) {}
 
 pub fn func5(
     _f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>,
-    _a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>,
+    _a: impl for<'beta, 'alpha, '_gamma> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>,
 ) {}
 
 pub trait Other {
diff --git a/tests/rustdoc/inline_cross/fn-type.rs b/tests/rustdoc/inline_cross/fn-type.rs
new file mode 100644
index 00000000000..e65790d3b05
--- /dev/null
+++ b/tests/rustdoc/inline_cross/fn-type.rs
@@ -0,0 +1,12 @@
+// Make sure that we print the higher-ranked parameters of cross-crate function pointer types.
+// They should be rendered exactly as the user wrote it, i.e., in source order and with unused
+// parameters present, not stripped.
+
+// aux-crate:fn_type=fn-type.rs
+// edition: 2021
+#![crate_name = "user"]
+
+// @has user/type.F.html
+// @has - '//*[@class="rust item-decl"]//code' \
+//     "for<'z, 'a, '_unused> fn(_: &'z for<'b> fn(_: &'b str), _: &'a ()) -> &'a ();"
+pub use fn_type::F;
diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs
index 5c802c51486..9b22026e490 100644
--- a/tests/rustdoc/inline_cross/impl_trait.rs
+++ b/tests/rustdoc/inline_cross/impl_trait.rs
@@ -29,7 +29,7 @@ pub use impl_trait_aux::func4;
 // @has impl_trait/fn.func5.html
 // @has - '//pre[@class="rust item-decl"]' "func5("
 // @has - '//pre[@class="rust item-decl"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>,"
-// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>"
+// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'beta, 'alpha, '_gamma> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>"
 // @!has - '//pre[@class="rust item-decl"]' 'where'
 pub use impl_trait_aux::func5;