diff options
| author | Michael Howell <michael@notriddle.com> | 2022-10-30 19:31:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-30 19:31:39 -0700 |
| commit | c61a32aff24653868c903f86c4e152ab39c220ac (patch) | |
| tree | e4b30a9c64d0ec9135ef9faaa629c3096cece0b0 /src/test | |
| parent | 16ca46297b34f924d8d082e8b7ae9ba4d87c66e2 (diff) | |
| parent | 3195388e82892fdcdd7351d67ead8eca45a66f90 (diff) | |
| download | rust-c61a32aff24653868c903f86c4e152ab39c220ac.tar.gz rust-c61a32aff24653868c903f86c4e152ab39c220ac.zip | |
Rollup merge of #103746 - notriddle:notriddle/incoherent-dyn-trait, r=GuillaumeGomez
rustdoc: add support for incoherent impls on structs and traits Fixes #103170
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc/auxiliary/incoherent-impl-types.rs | 7 | ||||
| -rw-r--r-- | src/test/rustdoc/rustc-incoherent-impls.rs | 28 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/test/rustdoc/auxiliary/incoherent-impl-types.rs b/src/test/rustdoc/auxiliary/incoherent-impl-types.rs new file mode 100644 index 00000000000..fc51e42e500 --- /dev/null +++ b/src/test/rustdoc/auxiliary/incoherent-impl-types.rs @@ -0,0 +1,7 @@ +#![feature(rustc_attrs)] + +#[rustc_has_incoherent_inherent_impls] +pub trait FooTrait {} + +#[rustc_has_incoherent_inherent_impls] +pub struct FooStruct; diff --git a/src/test/rustdoc/rustc-incoherent-impls.rs b/src/test/rustdoc/rustc-incoherent-impls.rs new file mode 100644 index 00000000000..3fdefbecc54 --- /dev/null +++ b/src/test/rustdoc/rustc-incoherent-impls.rs @@ -0,0 +1,28 @@ +// aux-build:incoherent-impl-types.rs +// build-aux-docs + +#![crate_name = "foo"] +#![feature(rustc_attrs)] + +extern crate incoherent_impl_types; + +// The only way this actually shows up is if the type gets inlined. +#[doc(inline)] +pub use incoherent_impl_types::FooTrait; + +// @has foo/trait.FooTrait.html +// @count - '//section[@id="method.do_something"]' 1 +impl dyn FooTrait { + #[rustc_allow_incoherent_impl] + pub fn do_something() {} +} + +#[doc(inline)] +pub use incoherent_impl_types::FooStruct; + +// @has foo/struct.FooStruct.html +// @count - '//section[@id="method.do_something"]' 1 +impl FooStruct { + #[rustc_allow_incoherent_impl] + pub fn do_something() {} +} |
