From 0da7adc8283211ffc649d169a94deed20f331c81 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Tue, 8 Feb 2022 17:42:22 +0800 Subject: rustdoc: Collect traits in scope for lang items --- .../auxiliary/extern-lang-item-impl-dep.rs | 29 ++++++++++++++++++++++ .../rustdoc/intra-doc/extern-lang-item-impl.rs | 11 ++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/test/rustdoc/intra-doc/auxiliary/extern-lang-item-impl-dep.rs create mode 100644 src/test/rustdoc/intra-doc/extern-lang-item-impl.rs (limited to 'src/test/rustdoc') diff --git a/src/test/rustdoc/intra-doc/auxiliary/extern-lang-item-impl-dep.rs b/src/test/rustdoc/intra-doc/auxiliary/extern-lang-item-impl-dep.rs new file mode 100644 index 00000000000..87ae2f096bb --- /dev/null +++ b/src/test/rustdoc/intra-doc/auxiliary/extern-lang-item-impl-dep.rs @@ -0,0 +1,29 @@ +// no-prefer-dynamic + +#![feature(lang_items)] + +#![crate_type = "rlib"] +#![no_std] + +pub struct DerefsToF64(f64); + +impl core::ops::Deref for DerefsToF64 { + type Target = f64; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +mod inner { + #[lang = "f64_runtime"] + impl f64 { + /// [f64::clone] + pub fn method() {} + } +} + +#[lang = "eh_personality"] +fn foo() {} + +#[panic_handler] +fn bar(_: &core::panic::PanicInfo) -> ! { loop {} } diff --git a/src/test/rustdoc/intra-doc/extern-lang-item-impl.rs b/src/test/rustdoc/intra-doc/extern-lang-item-impl.rs new file mode 100644 index 00000000000..f64f886f076 --- /dev/null +++ b/src/test/rustdoc/intra-doc/extern-lang-item-impl.rs @@ -0,0 +1,11 @@ +// Reexport of a structure that derefs to a type with lang item impls having doc links in their +// comments. The doc link points to an associated item, so we check that traits in scope for that +// link are populated. + +// aux-build:extern-lang-item-impl-dep.rs + +#![no_std] + +extern crate extern_lang_item_impl_dep; + +pub use extern_lang_item_impl_dep::DerefsToF64; -- cgit 1.4.1-3-g733a5