From 73db76015e39d18950d654d3a32ba9053261242f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 7 Mar 2016 23:55:52 -0800 Subject: doc: Fix a bunch of broken links A few categories: * Links into compiler docs were just all removed as we're not generating compiler docs. * Move up one more level to forcibly go to std docs to fix inlined documentation across the facade crates. --- src/libcore/any.rs | 2 +- src/libcore/char.rs | 18 +++++++++--------- src/libcore/iter.rs | 18 +++++++++--------- src/libcore/macros.rs | 8 ++++---- src/libcore/num/mod.rs | 6 +++--- src/libcore/slice.rs | 1 + src/libcore/str/mod.rs | 36 ++++++++++++++++++------------------ 7 files changed, 45 insertions(+), 44 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/any.rs b/src/libcore/any.rs index cb9bf935cdb..dfd2ba9154d 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -22,7 +22,7 @@ //! Note that &Any is limited to testing whether a value is of a specified //! concrete type, and cannot be used to test whether a type implements a trait. //! -//! [`Box`]: ../boxed/struct.Box.html +//! [`Box`]: ../../std/boxed/struct.Box.html //! //! # Examples //! diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 0c3807d8ca0..a23b303f4ba 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -69,7 +69,7 @@ const MAX_THREE_B: u32 = 0x10000; /// Point], but only ones within a certain range. `MAX` is the highest valid /// code point that's a valid [Unicode Scalar Value]. /// -/// [`char`]: ../primitive.char.html +/// [`char`]: ../../std/primitive.char.html /// [Unicode Scalar Value]: http://www.unicode.org/glossary/#unicode_scalar_value /// [Code Point]: http://www.unicode.org/glossary/#code_point #[stable(feature = "rust1", since = "1.0.0")] @@ -91,8 +91,8 @@ pub const MAX: char = '\u{10ffff}'; /// [`char`]s. `from_u32()` will return `None` if the input is not a valid value /// for a [`char`]. /// -/// [`char`]: ../primitive.char.html -/// [`u32`]: ../primitive.u32.html +/// [`char`]: ../../std/primitive.char.html +/// [`u32`]: ../../std/primitive.u32.html /// [`as`]: ../../book/casting-between-types.html#as /// /// For an unsafe version of this function which ignores these checks, see @@ -148,8 +148,8 @@ pub fn from_u32(i: u32) -> Option { /// [`char`]s. `from_u32_unchecked()` will ignore this, and blindly cast to /// [`char`], possibly creating an invalid one. /// -/// [`char`]: ../primitive.char.html -/// [`u32`]: ../primitive.u32.html +/// [`char`]: ../../std/primitive.char.html +/// [`u32`]: ../../std/primitive.u32.html /// [`as`]: ../../book/casting-between-types.html#as /// /// # Safety @@ -414,8 +414,8 @@ pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option { /// This `struct` is created by the [`escape_unicode()`] method on [`char`]. See /// its documentation for more. /// -/// [`escape_unicode()`]: ../primitive.char.html#method.escape_unicode -/// [`char`]: ../primitive.char.html +/// [`escape_unicode()`]: ../../std/primitive.char.html#method.escape_unicode +/// [`char`]: ../../std/primitive.char.html #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct EscapeUnicode { @@ -494,8 +494,8 @@ impl Iterator for EscapeUnicode { /// This `struct` is created by the [`escape_default()`] method on [`char`]. See /// its documentation for more. /// -/// [`escape_default()`]: ../primitive.char.html#method.escape_default -/// [`char`]: ../primitive.char.html +/// [`escape_default()`]: ../../std/primitive.char.html#method.escape_default +/// [`char`]: ../../std/primitive.char.html #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct EscapeDefault { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index fb8eda820f5..06821ff94f7 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -65,7 +65,7 @@ //! //! [`Iterator`]: trait.Iterator.html //! [`next()`]: trait.Iterator.html#tymethod.next -//! [`Option`]: ../option/enum.Option.html +//! [`Option`]: ../../std/option/enum.Option.html //! //! # The three forms of iteration //! @@ -804,7 +804,7 @@ pub trait Iterator { /// closure returns `None`, it will try again, and call the closure on the /// next element, seeing if it will return `Some`. /// - /// [`Option`]: ../option/enum.Option.html + /// [`Option`]: ../../std/option/enum.Option.html /// /// Why `filter_map()` and not just [`filter()`].[`map()`]? The key is in this /// part: @@ -866,7 +866,7 @@ pub trait Iterator { /// different sized integer, the [`zip()`] function provides similar /// functionality. /// - /// [`usize`]: ../primitive.usize.html + /// [`usize`]: ../../std/primitive.usize.html /// [`zip()`]: #method.zip /// /// # Overflow Behavior @@ -875,7 +875,7 @@ pub trait Iterator { /// [`usize::MAX`] elements either produces the wrong result or panics. If /// debug assertions are enabled, a panic is guaranteed. /// - /// [`usize::MAX`]: ../usize/constant.MAX.html + /// [`usize::MAX`]: ../../std/usize/constant.MAX.html /// /// # Panics /// @@ -1151,7 +1151,7 @@ pub trait Iterator { /// iterator and the return value from the closure, an [`Option`], is /// yielded by the iterator. /// - /// [`Option`]: ../option/enum.Option.html + /// [`Option`]: ../../std/option/enum.Option.html /// /// # Examples /// @@ -1385,9 +1385,9 @@ pub trait Iterator { /// be thought of as single `Result, E>`. See the examples /// below for more. /// - /// [`String`]: ../string/struct.String.html - /// [`Result`]: ../result/enum.Result.html - /// [`char`]: ../primitive.char.html + /// [`String`]: ../../std/string/struct.String.html + /// [`Result`]: ../../std/result/enum.Result.html + /// [`char`]: ../../std/primitive.char.html /// /// Because `collect()` is so general, it can cause problems with type /// inference. As such, `collect()` is one of the few times you'll see @@ -1412,7 +1412,7 @@ pub trait Iterator { /// Note that we needed the `: Vec` on the left-hand side. This is because /// we could collect into, for example, a [`VecDeque`] instead: /// - /// [`VecDeque`]: ../collections/struct.VecDeque.html + /// [`VecDeque`]: ../../std/collections/struct.VecDeque.html /// /// ``` /// use std::collections::VecDeque; diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 154ca30c62d..f923668688b 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -206,8 +206,8 @@ macro_rules! try { /// /// See [`std::fmt`][fmt] for more information on format syntax. /// -/// [fmt]: fmt/index.html -/// [write]: io/trait.Write.html +/// [fmt]: ../std/fmt/index.html +/// [write]: ../std/io/trait.Write.html /// /// # Examples /// @@ -232,8 +232,8 @@ macro_rules! write { /// /// See [`std::fmt`][fmt] for more information on format syntax. /// -/// [fmt]: fmt/index.html -/// [write]: io/trait.Write.html +/// [fmt]: ../std/fmt/index.html +/// [write]: ../std/io/trait.Write.html /// /// # Examples /// diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index ed370bb9164..0b306c810b1 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2179,8 +2179,8 @@ impl usize { /// This `enum` is used as the return type for [`f32::classify()`] and [`f64::classify()`]. See /// their documentation for more. /// -/// [`f32::classify()`]: ../primitive.f32.html#method.classify -/// [`f64::classify()`]: ../primitive.f64.html#method.classify +/// [`f32::classify()`]: ../../std/primitive.f32.html#method.classify +/// [`f64::classify()`]: ../../std/primitive.f64.html#method.classify #[derive(Copy, Clone, PartialEq, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub enum FpCategory { @@ -2411,7 +2411,7 @@ fn from_str_radix(src: &str, radix: u32) /// This error is used as the error type for the `from_str_radix()` functions /// on the primitive integer types, such as [`i8::from_str_radix()`]. /// -/// [`i8::from_str_radix()`]: ../std/primitive.i8.html#method.from_str_radix +/// [`i8::from_str_radix()`]: ../../std/primitive.i8.html#method.from_str_radix #[derive(Debug, Clone, PartialEq)] #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseIntError { kind: IntErrorKind } diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 8acd0c8f2cf..e59e8567d5b 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -908,6 +908,7 @@ impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} /// An internal abstraction over the splitting iterators, so that /// splitn, splitn_mut etc can be implemented once. +#[doc(hidden)] trait SplitIter: DoubleEndedIterator { /// Mark the underlying iterator as complete, extracting the remaining /// portion of the slice. diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 79f925aaab0..4480e7095e4 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -42,8 +42,8 @@ pub mod pattern; /// [`str`]'s [`parse()`] method. See [`parse()`]'s documentation for examples. /// /// [`from_str()`]: #tymethod.from_str -/// [`str`]: ../primitive.str.html -/// [`parse()`]: ../primitive.str.html#method.parse +/// [`str`]: ../../std/primitive.str.html +/// [`parse()`]: ../../std/primitive.str.html#method.parse #[stable(feature = "rust1", since = "1.0.0")] pub trait FromStr: Sized { /// The associated error which can be returned from parsing. @@ -60,7 +60,7 @@ pub trait FromStr: Sized { /// /// Basic usage with [`i32`][ithirtytwo], a type that implements `FromStr`: /// - /// [ithirtytwo]: ../primitive.i32.html + /// [ithirtytwo]: ../../std/primitive.i32.html /// /// ``` /// use std::str::FromStr; @@ -182,7 +182,7 @@ impl Utf8Error { /// If you need a `String` instead of a `&str`, consider /// [`String::from_utf8()`][string]. /// -/// [string]: ../string/struct.String.html#method.from_utf8 +/// [string]: ../../std/string/struct.String.html#method.from_utf8 /// /// Because you can stack-allocate a `[u8; N]`, and you can take a `&[u8]` of /// it, this function is one way to have a stack-allocated string. There is @@ -322,7 +322,7 @@ Section: Iterators /// /// Created with the method [`chars()`]. /// -/// [`chars()`]: ../primitive.str.html#method.chars +/// [`chars()`]: ../../std/primitive.str.html#method.chars #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct Chars<'a> { @@ -531,7 +531,7 @@ impl<'a> CharIndices<'a> { /// /// Created with the method [`bytes()`]. /// -/// [`bytes()`]: ../primitive.str.html#method.bytes +/// [`bytes()`]: ../../std/primitive.str.html#method.bytes #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] pub struct Bytes<'a>(Cloned>); @@ -816,12 +816,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`split()`]. /// - /// [`split()`]: ../primitive.str.html#method.split + /// [`split()`]: ../../std/primitive.str.html#method.split struct Split; reverse: /// Created with the method [`rsplit()`]. /// - /// [`rsplit()`]: ../primitive.str.html#method.rsplit + /// [`rsplit()`]: ../../std/primitive.str.html#method.rsplit struct RSplit; stability: #[stable(feature = "rust1", since = "1.0.0")] @@ -834,12 +834,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`split_terminator()`]. /// - /// [`split_terminator()`]: ../primitive.str.html#method.split_terminator + /// [`split_terminator()`]: ../../std/primitive.str.html#method.split_terminator struct SplitTerminator; reverse: /// Created with the method [`rsplit_terminator()`]. /// - /// [`rsplit_terminator()`]: ../primitive.str.html#method.rsplit_terminator + /// [`rsplit_terminator()`]: ../../std/primitive.str.html#method.rsplit_terminator struct RSplitTerminator; stability: #[stable(feature = "rust1", since = "1.0.0")] @@ -884,12 +884,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`splitn()`]. /// - /// [`splitn()`]: ../primitive.str.html#method.splitn + /// [`splitn()`]: ../../std/primitive.str.html#method.splitn struct SplitN; reverse: /// Created with the method [`rsplitn()`]. /// - /// [`rsplitn()`]: ../primitive.str.html#method.rsplitn + /// [`rsplitn()`]: ../../std/primitive.str.html#method.rsplitn struct RSplitN; stability: #[stable(feature = "rust1", since = "1.0.0")] @@ -926,12 +926,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`match_indices()`]. /// - /// [`match_indices()`]: ../primitive.str.html#method.match_indices + /// [`match_indices()`]: ../../std/primitive.str.html#method.match_indices struct MatchIndices; reverse: /// Created with the method [`rmatch_indices()`]. /// - /// [`rmatch_indices()`]: ../primitive.str.html#method.rmatch_indices + /// [`rmatch_indices()`]: ../../std/primitive.str.html#method.rmatch_indices struct RMatchIndices; stability: #[stable(feature = "str_match_indices", since = "1.5.0")] @@ -970,12 +970,12 @@ generate_pattern_iterators! { forward: /// Created with the method [`matches()`]. /// - /// [`matches()`]: ../primitive.str.html#method.matches + /// [`matches()`]: ../../std/primitive.str.html#method.matches struct Matches; reverse: /// Created with the method [`rmatches()`]. /// - /// [`rmatches()`]: ../primitive.str.html#method.rmatches + /// [`rmatches()`]: ../../std/primitive.str.html#method.rmatches struct RMatches; stability: #[stable(feature = "str_matches", since = "1.2.0")] @@ -986,7 +986,7 @@ generate_pattern_iterators! { /// Created with the method [`lines()`]. /// -/// [`lines()`]: ../primitive.str.html#method.lines +/// [`lines()`]: ../../std/primitive.str.html#method.lines #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] pub struct Lines<'a>(Map, LinesAnyMap>); @@ -1016,7 +1016,7 @@ impl<'a> DoubleEndedIterator for Lines<'a> { /// Created with the method [`lines_any()`]. /// -/// [`lines_any()`]: ../primitive.str.html#method.lines_any +/// [`lines_any()`]: ../../std/primitive.str.html#method.lines_any #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(since = "1.4.0", reason = "use lines()/Lines instead now")] #[derive(Clone)] -- cgit 1.4.1-3-g733a5 From 8aa268e731aa201e086675f38e4337702c63f104 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 8 Mar 2016 11:19:03 -0800 Subject: std: Fix rustdoc links with std::fmt::Alignment This is actually a reexported implementation detail in the `rt::v1` module but rustdoc doesn't like reexporting items from `doc(hidden)` modules. Do what we'd end up doing anyway from an API perspective and make a public-facing `enum` that can be retranslated under the hood if necessary. --- src/libcore/fmt/mod.rs | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 6cc3b4e01b8..7927b338044 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -22,7 +22,19 @@ use ops::Deref; use result; use slice; use str; -use self::rt::v1::Alignment; + +#[unstable(feature = "fmt_flags_align", issue = "27726")] +/// Possible alignments returned by `Formatter::align` +pub enum Alignment { + /// Indication that contents should be left-aligned. + Left, + /// Indication that contents should be right-aligned. + Right, + /// Indication that contents should be center-aligned. + Center, + /// No alignment was requested. + Unknown, +} #[unstable(feature = "fmt_radix", issue = "27728")] #[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")] @@ -780,7 +792,7 @@ pub fn write(output: &mut Write, args: Arguments) -> Result { width: None, precision: None, buf: output, - align: Alignment::Unknown, + align: rt::v1::Alignment::Unknown, fill: ' ', args: args.args, curarg: args.args.iter(), @@ -920,13 +932,13 @@ impl<'a> Formatter<'a> { Some(min) if self.sign_aware_zero_pad() => { self.fill = '0'; try!(write_prefix(self)); - self.with_padding(min - width, Alignment::Right, |f| { + self.with_padding(min - width, rt::v1::Alignment::Right, |f| { f.buf.write_str(buf) }) } // Otherwise, the sign and prefix goes after the padding Some(min) => { - self.with_padding(min - width, Alignment::Right, |f| { + self.with_padding(min - width, rt::v1::Alignment::Right, |f| { try!(write_prefix(f)); f.buf.write_str(buf) }) } @@ -973,7 +985,8 @@ impl<'a> Formatter<'a> { // If we're under both the maximum and the minimum width, then fill // up the minimum width with the specified string + some alignment. Some(width) => { - self.with_padding(width - s.chars().count(), Alignment::Left, |me| { + let align = rt::v1::Alignment::Left; + self.with_padding(width - s.chars().count(), align, |me| { me.buf.write_str(s) }) } @@ -982,20 +995,21 @@ impl<'a> Formatter<'a> { /// Runs a callback, emitting the correct padding either before or /// afterwards depending on whether right or left alignment is requested. - fn with_padding(&mut self, padding: usize, default: Alignment, + fn with_padding(&mut self, padding: usize, default: rt::v1::Alignment, f: F) -> Result where F: FnOnce(&mut Formatter) -> Result, { use char::CharExt; let align = match self.align { - Alignment::Unknown => default, + rt::v1::Alignment::Unknown => default, _ => self.align }; let (pre_pad, post_pad) = match align { - Alignment::Left => (0, padding), - Alignment::Right | Alignment::Unknown => (padding, 0), - Alignment::Center => (padding / 2, (padding + 1) / 2), + rt::v1::Alignment::Left => (0, padding), + rt::v1::Alignment::Right | + rt::v1::Alignment::Unknown => (padding, 0), + rt::v1::Alignment::Center => (padding / 2, (padding + 1) / 2), }; let mut fill = [0; 4]; @@ -1033,7 +1047,7 @@ impl<'a> Formatter<'a> { // remove the sign from the formatted parts formatted.sign = b""; width = if width < sign.len() { 0 } else { width - sign.len() }; - align = Alignment::Right; + align = rt::v1::Alignment::Right; self.fill = '0'; } @@ -1116,7 +1130,14 @@ impl<'a> Formatter<'a> { /// Flag indicating what form of alignment was requested #[unstable(feature = "fmt_flags_align", reason = "method was just created", issue = "27726")] - pub fn align(&self) -> Alignment { self.align } + pub fn align(&self) -> Alignment { + match self.align { + rt::v1::Alignment::Left => Alignment::Left, + rt::v1::Alignment::Right => Alignment::Right, + rt::v1::Alignment::Center => Alignment::Center, + rt::v1::Alignment::Unknown => Alignment::Unknown, + } + } /// Optionally specified integer width that the output should be #[stable(feature = "fmt_flags", since = "1.5.0")] -- cgit 1.4.1-3-g733a5