-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Some little Rustdoc fixes #21999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some little Rustdoc fixes #21999
Changes from all commits
43b8503
abae840
df1cfde
e43c478
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-include ../tools.mk | ||
|
||
all: lib.rs | ||
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs | ||
$(HTMLDOCCK) $(TMPDIR)/doc lib.rs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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. | ||
|
||
#![crate_type="lib"] | ||
|
||
// @has lib/trait.Index.html | ||
pub trait Index<I: ?Sized> { | ||
// @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized' | ||
type Output: ?Sized; | ||
// @has - '//*[@id="tymethod.index"]//code' \ | ||
// "fn index<'a>(&'a self, index: I) -> &'a Self::Output" | ||
fn index<'a>(&'a self, index: I) -> &'a Self::Output; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-include ../tools.mk | ||
|
||
all: foo.rs bar.rs | ||
$(HOST_RPATH_ENV) $(RUSTC) foo.rs | ||
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs | ||
$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc bar.rs | ||
$(HTMLDOCCK) $(TMPDIR)/doc bar.rs | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 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. | ||
|
||
extern crate foo; | ||
|
||
// @has bar/trait.Foo.html //pre "pub trait Foo" | ||
// @has - '//*[@id="tymethod.foo"]//code' 'extern "rust-call" fn foo' | ||
// @has - '//*[@id="tymethod.foo_"]//code' 'extern "rust-call" fn foo_' | ||
pub use foo::Foo; | ||
|
||
// @has bar/trait.Bar.html //pre "pub trait Bar" | ||
pub trait Bar { | ||
// @has - '//*[@id="tymethod.bar"]//code' 'extern "rust-call" fn bar' | ||
extern "rust-call" fn bar(&self, _: ()); | ||
// @has - '//*[@id="method.bar_"]//code' 'extern "rust-call" fn bar_' | ||
extern "rust-call" fn bar_(&self, _: ()) { } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// 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. | ||
|
||
#![crate_type="lib"] | ||
|
||
pub trait Foo { | ||
extern "rust-call" fn foo(&self, _: ()) -> i32; | ||
extern "rust-call" fn foo_(&self, _: ()) -> i32 { 0 } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-include ../tools.mk | ||
|
||
all: lib.rs | ||
$(HOST_RPATH_ENV) $(RUSTC) lib.rs | ||
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs | ||
$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc user.rs | ||
$(HTMLDOCCK) $(TMPDIR)/doc lib.rs | ||
$(HTMLDOCCK) $(TMPDIR)/doc user.rs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// 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. | ||
|
||
#![crate_type="lib"] | ||
|
||
extern "C" { | ||
// @has lib/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)' | ||
pub fn foreigner(cold_as_ice: u32); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// 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. | ||
|
||
#![crate_type="lib"] | ||
|
||
extern crate lib; | ||
|
||
// @has user/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think technically this should have an ABI listed of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They aren't shown that way in the docs for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened #22038 |
||
pub use lib::foreigner; |
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 believe these sort of associated-type paths exist are possible for any type, that is, they can start with something other than
Self
. I have no idea how to detect such things.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.
(In fact, I believe a hybrid path like
std::slice::Iter<T>::Item
is possible too.)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.
This is a good point... the ideal rendering of a type like that in rustdocs for a trait would be
Iter<T>::Item
, withIter
hyperlinked to the appropriate place (possibly in another crate's documentation). So is it a matter of walking path segments and looking for the first non-module and printing the rest of the path from that segment when rendering a path in "short" (less than fully-qualified) form?