Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik

Cosmetic improvements to doc comments

This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase).

r? @steveklabnik

Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
This commit is contained in:
bors 2019-02-12 19:09:24 +00:00
commit b244f61b77
486 changed files with 2850 additions and 2822 deletions

View file

@ -68,7 +68,7 @@ scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals);
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)]
pub enum FileName {
Real(PathBuf),
/// A macro. This includes the full name of the macro, so that there are no clashes.
/// A macro. This includes the full name of the macro, so that there are no clashes.
Macros(String),
/// Call to `quote!`.
QuoteExpansion(u64),
@ -305,21 +305,21 @@ impl Span {
if self.is_dummy() { other } else { self }
}
/// Return `true` if `self` fully encloses `other`.
/// Returns `true` if `self` fully encloses `other`.
pub fn contains(self, other: Span) -> bool {
let span = self.data();
let other = other.data();
span.lo <= other.lo && other.hi <= span.hi
}
/// Return `true` if `self` touches `other`.
/// Returns `true` if `self` touches `other`.
pub fn overlaps(self, other: Span) -> bool {
let span = self.data();
let other = other.data();
span.lo < other.hi && other.lo < span.hi
}
/// Return true if the spans are equal with regards to the source text.
/// Returns `true` if the spans are equal with regards to the source text.
///
/// Use this instead of `==` when either span could be generated code,
/// and you only care that they point to the same bytes of source text.
@ -340,7 +340,7 @@ impl Span {
}
}
/// Return the source span -- this is either the supplied span, or the span for
/// Returns the source span -- this is either the supplied span, or the span for
/// the macro callsite that expanded to it.
pub fn source_callsite(self) -> Span {
self.ctxt().outer().expn_info().map(|info| info.call_site.source_callsite()).unwrap_or(self)
@ -368,7 +368,7 @@ impl Span {
self.edition() >= edition::Edition::Edition2018
}
/// Return the source callee.
/// Returns the source callee.
///
/// Returns `None` if the supplied span has no expansion trace,
/// else returns the `ExpnInfo` for the macro definition
@ -383,7 +383,7 @@ impl Span {
self.ctxt().outer().expn_info().map(source_callee)
}
/// Check if a span is "internal" to a macro in which `#[unstable]`
/// Checks if a span is "internal" to a macro in which `#[unstable]`
/// items can be used (that is, a macro marked with
/// `#[allow_internal_unstable]`).
pub fn allows_unstable(&self, feature: &str) -> bool {
@ -397,7 +397,7 @@ impl Span {
}
}
/// Check if this span arises from a compiler desugaring of kind `kind`.
/// Checks if this span arises from a compiler desugaring of kind `kind`.
pub fn is_compiler_desugaring(&self, kind: CompilerDesugaringKind) -> bool {
match self.ctxt().outer().expn_info() {
Some(info) => match info.format {
@ -408,7 +408,7 @@ impl Span {
}
}
/// Return the compiler desugaring that created this span, or `None`
/// Returns the compiler desugaring that created this span, or `None`
/// if this span is not from a desugaring.
pub fn compiler_desugaring_kind(&self) -> Option<CompilerDesugaringKind> {
match self.ctxt().outer().expn_info() {
@ -420,7 +420,7 @@ impl Span {
}
}
/// Check if a span is "internal" to a macro in which `unsafe`
/// Checks if a span is "internal" to a macro in which `unsafe`
/// can be used without triggering the `unsafe_code` lint
// (that is, a macro marked with `#[allow_internal_unsafe]`).
pub fn allows_unsafe(&self) -> bool {
@ -454,7 +454,7 @@ impl Span {
result
}
/// Return a `Span` that would enclose both `self` and `end`.
/// Returns a `Span` that would enclose both `self` and `end`.
pub fn to(self, end: Span) -> Span {
let span_data = self.data();
let end_data = end.data();
@ -477,7 +477,7 @@ impl Span {
)
}
/// Return a `Span` between the end of `self` to the beginning of `end`.
/// Returns a `Span` between the end of `self` to the beginning of `end`.
pub fn between(self, end: Span) -> Span {
let span = self.data();
let end = end.data();
@ -488,7 +488,7 @@ impl Span {
)
}
/// Return a `Span` between the beginning of `self` to the beginning of `end`.
/// Returns a `Span` between the beginning of `self` to the beginning of `end`.
pub fn until(self, end: Span) -> Span {
let span = self.data();
let end = end.data();
@ -660,7 +660,7 @@ impl MultiSpan {
&self.primary_spans
}
/// Returns whether any of the primary spans is displayable.
/// Returns `true` if any of the primary spans are displayable.
pub fn has_primary_spans(&self) -> bool {
self.primary_spans.iter().any(|sp| !sp.is_dummy())
}
@ -677,7 +677,7 @@ impl MultiSpan {
}
/// Replaces all occurrences of one Span with another. Used to move `Span`s in areas that don't
/// display well (like std macros). Returns true if replacements occurred.
/// display well (like std macros). Returns whether replacements occurred.
pub fn replace(&mut self, before: Span, after: Span) -> bool {
let mut replacements_occurred = false;
for primary_span in &mut self.primary_spans {
@ -724,7 +724,7 @@ impl MultiSpan {
span_labels
}
/// Returns whether any of the span labels is displayable.
/// Returns `true` if any of the span labels is displayable.
pub fn has_span_labels(&self) -> bool {
self.span_labels.iter().any(|(sp, _)| !sp.is_dummy())
}
@ -853,7 +853,7 @@ pub struct SourceFile {
/// originate from files has names between angle brackets by convention
/// (e.g., `<anon>`).
pub name: FileName,
/// True if the `name` field above has been modified by `--remap-path-prefix`.
/// `true` if the `name` field above has been modified by `--remap-path-prefix`.
pub name_was_remapped: bool,
/// The unmapped path of the file that the source came from.
/// Set to `None` if the `SourceFile` was imported from an external crate.
@ -1062,7 +1062,7 @@ impl SourceFile {
}
}
/// Return the `BytePos` of the beginning of the current line.
/// Returns the `BytePos` of the beginning of the current line.
pub fn line_begin_pos(&self, pos: BytePos) -> BytePos {
let line_index = self.lookup_line(pos).unwrap();
self.lines[line_index]
@ -1101,7 +1101,7 @@ impl SourceFile {
}
}
/// Get a line from the list of pre-computed line-beginnings.
/// Gets a line from the list of pre-computed line-beginnings.
/// The line number here is 0-based.
pub fn get_line(&self, line_number: usize) -> Option<Cow<'_, str>> {
fn get_until_newline(src: &str, begin: usize) -> &str {
@ -1149,7 +1149,7 @@ impl SourceFile {
self.lines.len()
}
/// Find the line containing the given position. The return value is the
/// Finds the line containing the given position. The return value is the
/// index into the `lines` array of this `SourceFile`, not the 1-based line
/// number. If the source_file is empty or the position is located before the
/// first line, `None` is returned.
@ -1186,7 +1186,7 @@ impl SourceFile {
}
}
/// Remove utf-8 BOM if any.
/// Removes UTF-8 BOM, if any.
fn remove_bom(src: &mut String) {
if src.starts_with("\u{feff}") {
src.drain(..3);