forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#103746 - notriddle:notriddle/incoherent-dyn…
…-trait, r=GuillaumeGomez rustdoc: add support for incoherent impls on structs and traits Fixes rust-lang#103170
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#![feature(rustc_attrs)] | ||
|
||
#[rustc_has_incoherent_inherent_impls] | ||
pub trait FooTrait {} | ||
|
||
#[rustc_has_incoherent_inherent_impls] | ||
pub struct FooStruct; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} | ||
} |