forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustdoc: Render methods/impls for bare traits
This renders a "Methods" and "Trait Implementations" section for each item implemented for a bare trait itself. Closes rust-lang#19055
- Loading branch information
1 parent
ba40231
commit 8f6855c
Showing
2 changed files
with
65 additions
and
32 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,30 @@ | ||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// @has issue_19055/trait.Any.html | ||
pub trait Any {} | ||
|
||
impl<'any> Any + 'any { | ||
// @has - '//*[@id="method.is"]' 'fn is' | ||
pub fn is<T: 'static>(&self) -> bool { loop {} } | ||
|
||
// @has - '//*[@id="method.downcast_ref"]' 'fn downcast_ref' | ||
pub fn downcast_ref<T: 'static>(&self) -> Option<&T> { loop {} } | ||
|
||
// @has - '//*[@id="method.downcast_mut"]' 'fn downcast_mut' | ||
pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> { loop {} } | ||
} | ||
|
||
pub trait Foo { | ||
fn foo(&self) {} | ||
} | ||
|
||
// @has - '//*[@id="method.foo"]' 'fn foo' | ||
impl Foo for Any {} |
8f6855c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this does not entirely fix rust-lang#19055 (comment), since clicking on
downcast_ref
in search results gives you a 404.8f6855c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that the original issue has been addressed, though. Maybe we should fork off a separate issue for the 404.
8f6855c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a feeling we think alike sometimes!