Skip to content

Commit f2c2736

Browse files
committed
Rollup merge of rust-lang#25290 - bluss:docfixes, r=steveklabnik
Several Minor API / Reference Documentation Fixes - Fix a few small errors in the reference. - Fix paper cuts in the API docs. Fixes rust-lang#24882 Fixes rust-lang#25233 Fixes rust-lang#25250
2 parents 8f01d8d + aabdd8e commit f2c2736

File tree

6 files changed

+32
-17
lines changed

6 files changed

+32
-17
lines changed

src/doc/reference.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,10 @@ There are several kinds of item:
653653
* [`use` declarations](#use-declarations)
654654
* [modules](#modules)
655655
* [functions](#functions)
656-
* [type definitions](#type-definitions)
656+
* [type aliases](#type-aliases)
657657
* [structures](#structures)
658658
* [enumerations](#enumerations)
659+
* [constant items](#constant-items)
659660
* [static items](#static-items)
660661
* [traits](#traits)
661662
* [implementations](#implementations)
@@ -672,16 +673,16 @@ which sub-item declarations may appear.
672673

673674
### Type Parameters
674675

675-
All items except modules may be *parameterized* by type. Type parameters are
676-
given as a comma-separated list of identifiers enclosed in angle brackets
677-
(`<...>`), after the name of the item and before its definition. The type
678-
parameters of an item are considered "part of the name", not part of the type
679-
of the item. A referencing [path](#paths) must (in principle) provide type
680-
arguments as a list of comma-separated types enclosed within angle brackets, in
681-
order to refer to the type-parameterized item. In practice, the type-inference
682-
system can usually infer such argument types from context. There are no
683-
general type-parametric types, only type-parametric items. That is, Rust has
684-
no notion of type abstraction: there are no first-class "forall" types.
676+
All items except modules, constants and statics may be *parameterized* by type.
677+
Type parameters are given as a comma-separated list of identifiers enclosed in
678+
angle brackets (`<...>`), after the name of the item and before its definition.
679+
The type parameters of an item are considered "part of the name", not part of
680+
the type of the item. A referencing [path](#paths) must (in principle) provide
681+
type arguments as a list of comma-separated types enclosed within angle
682+
brackets, in order to refer to the type-parameterized item. In practice, the
683+
type-inference system can usually infer such argument types from context. There
684+
are no general type-parametric types, only type-parametric items. That is, Rust
685+
has no notion of type abstraction: there are no first-class "forall" types.
685686

686687
### Modules
687688

@@ -743,7 +744,7 @@ mod thread {
743744
}
744745
```
745746

746-
##### Extern crate declarations
747+
#### Extern crate declarations
747748

748749
An _`extern crate` declaration_ specifies a dependency on an external crate.
749750
The external crate is then bound into the declaring scope as the `ident`
@@ -767,7 +768,7 @@ extern crate std; // equivalent to: extern crate std as std;
767768
extern crate std as ruststd; // linking to 'std' under another name
768769
```
769770

770-
##### Use declarations
771+
#### Use declarations
771772

772773
A _use declaration_ creates one or more local name bindings synonymous with
773774
some other [path](#paths). Usually a `use` declaration is used to shorten the

src/libcollections/slice.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ pub trait SliceConcatExt<T: ?Sized> {
10021002
/// The resulting type after concatenation
10031003
type Output;
10041004

1005-
/// Flattens a slice of `T` into a single value `U`.
1005+
/// Flattens a slice of `T` into a single value `Self::Output`.
10061006
///
10071007
/// # Examples
10081008
///
@@ -1012,7 +1012,8 @@ pub trait SliceConcatExt<T: ?Sized> {
10121012
#[stable(feature = "rust1", since = "1.0.0")]
10131013
fn concat(&self) -> Self::Output;
10141014

1015-
/// Flattens a slice of `T` into a single value `U`, placing a given separator between each.
1015+
/// Flattens a slice of `T` into a single value `Self::Output`, placing a given separator
1016+
/// between each.
10161017
///
10171018
/// # Examples
10181019
///

src/libcore/str/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ pub trait FromStr {
4444
#[stable(feature = "rust1", since = "1.0.0")]
4545
type Err;
4646

47-
/// Parses a string `s` to return an optional value of this type. If the
48-
/// string is ill-formatted, the None is returned.
47+
/// Parses a string `s` to return a value of this type.
48+
///
49+
/// If parsing succeeds, return the value inside `Ok`, otherwise
50+
/// when the string is ill-formatted return an error specific to the
51+
/// inside `Err`. The error type is specific to implementation of the trait.
4952
#[stable(feature = "rust1", since = "1.0.0")]
5053
fn from_str(s: &str) -> Result<Self, Self::Err>;
5154
}

src/libstd/path.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,8 @@ impl Path {
14491449

14501450
/// Determines whether `base` is a prefix of `self`.
14511451
///
1452+
/// Only considers whole path components to match.
1453+
///
14521454
/// # Examples
14531455
///
14541456
/// ```
@@ -1457,6 +1459,8 @@ impl Path {
14571459
/// let path = Path::new("/etc/passwd");
14581460
///
14591461
/// assert!(path.starts_with("/etc"));
1462+
///
1463+
/// assert!(!path.starts_with("/e"));
14601464
/// ```
14611465
#[stable(feature = "rust1", since = "1.0.0")]
14621466
pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
@@ -1465,6 +1469,8 @@ impl Path {
14651469

14661470
/// Determines whether `child` is a suffix of `self`.
14671471
///
1472+
/// Only considers whole path components to match.
1473+
///
14681474
/// # Examples
14691475
///
14701476
/// ```

src/libstd/thread/local.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ pub struct LocalKey<T> {
8585
}
8686

8787
/// Declare a new thread local storage key of type `std::thread::LocalKey`.
88+
///
89+
/// See [LocalKey documentation](thread/struct.LocalKey.html) for more information.
8890
#[macro_export]
8991
#[stable(feature = "rust1", since = "1.0.0")]
9092
#[allow_internal_unstable]

src/libstd/thread/scoped_tls.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ pub struct ScopedKey<T> { #[doc(hidden)] pub inner: __impl::KeyInner<T> }
6666
///
6767
/// This macro declares a `static` item on which methods are used to get and
6868
/// set the value stored within.
69+
///
70+
/// See [ScopedKey documentation](thread/struct.ScopedKey.html) for more information.
6971
#[macro_export]
7072
#[allow_internal_unstable]
7173
macro_rules! scoped_thread_local {

0 commit comments

Comments
 (0)