about summary refs log tree commit diff
path: root/tests/rustdoc/anon-fn-params.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-04-18 13:49:17 +0000
committerbors <bors@rust-lang.org>2025-04-18 13:49:17 +0000
commit191df20fcad9331d3a948aa8e8556775ec3fe69d (patch)
treef74fb63b5aa5487852469be80310c79a9ff95f2f /tests/rustdoc/anon-fn-params.rs
parent6a0bd27619a997ba7f040a28a41c3511423a3117 (diff)
parent8cb57ed74bcd58b0499e5f9dd5e39cbef804d83f (diff)
downloadrust-191df20fcad9331d3a948aa8e8556775ec3fe69d.tar.gz
rust-191df20fcad9331d3a948aa8e8556775ec3fe69d.zip
Auto merge of #139996 - matthiaskrgr:rollup-0nka2hw, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #138528 (deref patterns: implement implicit deref patterns)
 - #139393 (rustdoc-json: Output target feature information)
 - #139553 (sync::mpsc: prevent double free on `Drop`)
 - #139615 (Remove `name_or_empty`)
 - #139853 (Disable combining LLD with external llvm-config)
 - #139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions))
 - #139942 (Ignore aix for tests/ui/erros/pic-linker.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/rustdoc/anon-fn-params.rs')
-rw-r--r--tests/rustdoc/anon-fn-params.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/rustdoc/anon-fn-params.rs b/tests/rustdoc/anon-fn-params.rs
new file mode 100644
index 00000000000..9af1af3d3fa
--- /dev/null
+++ b/tests/rustdoc/anon-fn-params.rs
@@ -0,0 +1,25 @@
+// Test that we render the deprecated anonymous trait function parameters from Rust 2015 as
+// underscores in order not to perpetuate it and for legibility.
+
+//@ edition: 2015
+#![expect(anonymous_parameters)]
+
+// Check the "local case" (HIR cleaning) //
+
+//@ has anon_fn_params/trait.Trait.html
+pub trait Trait {
+    //@ has - '//*[@id="tymethod.required"]' 'fn required(_: Option<i32>, _: impl Fn(&str) -> bool)'
+    fn required(Option<i32>, impl Fn(&str) -> bool);
+    //@ has - '//*[@id="method.provided"]' 'fn provided(_: [i32; 2])'
+    fn provided([i32; 2]) {}
+}
+
+// Check the "extern case" (middle cleaning) //
+
+//@ aux-build: ext-anon-fn-params.rs
+extern crate ext_anon_fn_params;
+
+//@ has anon_fn_params/trait.ExtTrait.html
+//@ has - '//*[@id="tymethod.required"]' 'fn required(_: Option<i32>, _: impl Fn(&str) -> bool)'
+//@ has - '//*[@id="method.provided"]' 'fn provided(_: [i32; 2])'
+pub use ext_anon_fn_params::Trait as ExtTrait;