diff options
| author | bors <bors@rust-lang.org> | 2021-05-23 14:54:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-23 14:54:14 +0000 |
| commit | 13bf0b2a3cc38ba9ed9a1542d8f2a7e98059a8aa (patch) | |
| tree | d66877f608dd3f70a261365ad0fd5eb5e4844ac7 /src/test/rustdoc | |
| parent | 0f8cd43ee8c3614e04b5c624dd8a45758d7023da (diff) | |
| parent | d637ed4364822a9a03248179098437adffaa3948 (diff) | |
| download | rust-13bf0b2a3cc38ba9ed9a1542d8f2a7e98059a8aa.tar.gz rust-13bf0b2a3cc38ba9ed9a1542d8f2a7e98059a8aa.zip | |
Auto merge of #85479 - Stupremee:render-Self_as-type-casts, r=CraftSpider
rustdoc: render `<Self as X>::Y` type casts properly Rustdoc didn't render any `<Self as X>` casts which causes invalid code inside the documentation. This is fixed by this PR by checking if the target type `X` is different from `Self`, and if so, it will render a typecast. Resolves #85454
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/issue-85454.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/rustdoc/issue-85454.rs b/src/test/rustdoc/issue-85454.rs new file mode 100644 index 00000000000..45664dfc382 --- /dev/null +++ b/src/test/rustdoc/issue-85454.rs @@ -0,0 +1,17 @@ +// @has issue_85454/trait.FromResidual.html +// @has - '//pre[@class="rust trait"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' +pub trait FromResidual<R = <Self as Try>::Residual> { + fn from_residual(residual: R) -> Self; +} + +pub trait Try: FromResidual { + type Output; + type Residual; + fn from_output(output: Self::Output) -> Self; + fn branch(self) -> ControlFlow<Self::Residual, Self::Output>; +} + +pub enum ControlFlow<B, C = ()> { + Continue(C), + Break(B), +} |
