Skip to content

Commit 09006d6

Browse files
committed
Convert some module-level // and /// comments to //!.
This makes their intent and expected location clearer. We see some examples where these comments were not clearly separate from `use` declarations, which made it hard to understand what the comment is describing.
1 parent 894f7a4 commit 09006d6

File tree

9 files changed

+32
-26
lines changed

9 files changed

+32
-26
lines changed

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
//! The expansion from a test function to the appropriate test struct for libtest
2+
//! Ideally, this code would be in libtest but for efficiency and error messages it lives here.
3+
14
use crate::errors;
2-
/// The expansion from a test function to the appropriate test struct for libtest
3-
/// Ideally, this code would be in libtest but for efficiency and error messages it lives here.
45
use crate::util::{check_builtin_macro_attribute, warn_on_duplicate_attribute};
56
use rustc_ast::ptr::P;
67
use rustc_ast::{self as ast, attr, GenericParamKind};

compiler/rustc_data_structures/src/base_n.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/// Converts unsigned integers into a string representation with some base.
2-
/// Bases up to and including 36 can be used for case-insensitive things.
1+
//! Converts unsigned integers into a string representation with some base.
2+
//! Bases up to and including 36 can be used for case-insensitive things.
3+
34
use std::ascii;
45
use std::fmt;
56

compiler/rustc_middle/src/mir/statement.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/// Functionality for statements, operands, places, and things that appear in them.
1+
//! Functionality for statements, operands, places, and things that appear in them.
2+
23
use super::{interpret::GlobalAlloc, *};
34

45
///////////////////////////////////////////////////////////////////////////

compiler/rustc_middle/src/mir/terminator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/// Functionality for terminators and helper types that appear in terminators.
1+
//! Functionality for terminators and helper types that appear in terminators.
2+
23
use rustc_hir::LangItem;
34
use smallvec::{smallvec, SmallVec};
45

compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/// A target tuple for OpenWrt MIPS64 targets
2-
///
1+
//! A target tuple for OpenWrt MIPS64 targets.
2+
33
use crate::abi::Endian;
44
use crate::spec::{base, Target, TargetOptions};
55

library/alloc/src/boxed/thin.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// Based on
2-
// https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs
3-
// by matthieu-m
1+
//! Based on
2+
//! <https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs>
3+
//! by matthieu-m
4+
45
use crate::alloc::{self, Layout, LayoutError};
56
use core::error::Error;
67
use core::fmt::{self, Debug, Display, Formatter};

library/portable-simd/crates/core_simd/examples/dot_product.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// Code taken from the `packed_simd` crate
2-
// Run this code with `cargo test --example dot_product`
3-
//use std::iter::zip;
1+
//! Code taken from the `packed_simd` crate.
2+
//! Run this code with `cargo test --example dot_product`.
43
54
#![feature(array_chunks)]
65
#![feature(slice_as_chunks)]

library/std/src/io/buffered/bufreader/buffer.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
///! An encapsulation of `BufReader`'s buffer management logic.
2-
///
3-
/// This module factors out the basic functionality of `BufReader` in order to protect two core
4-
/// invariants:
5-
/// * `filled` bytes of `buf` are always initialized
6-
/// * `pos` is always <= `filled`
7-
/// Since this module encapsulates the buffer management logic, we can ensure that the range
8-
/// `pos..filled` is always a valid index into the initialized region of the buffer. This means
9-
/// that user code which wants to do reads from a `BufReader` via `buffer` + `consume` can do so
10-
/// without encountering any runtime bounds checks.
1+
//! An encapsulation of `BufReader`'s buffer management logic.
2+
//!
3+
//! This module factors out the basic functionality of `BufReader` in order to protect two core
4+
//! invariants:
5+
//! * `filled` bytes of `buf` are always initialized
6+
//! * `pos` is always <= `filled`
7+
//! Since this module encapsulates the buffer management logic, we can ensure that the range
8+
//! `pos..filled` is always a valid index into the initialized region of the buffer. This means
9+
//! that user code which wants to do reads from a `BufReader` via `buffer` + `consume` can do so
10+
//! without encountering any runtime bounds checks.
11+
1112
use crate::cmp;
1213
use crate::io::{self, BorrowedBuf, Read};
1314
use crate::mem::MaybeUninit;

library/std/src/sys/os_str/wtf8.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/// The underlying OsString/OsStr implementation on Windows is a
2-
/// wrapper around the "WTF-8" encoding; see the `wtf8` module for more.
1+
//! The underlying OsString/OsStr implementation on Windows is a
2+
//! wrapper around the "WTF-8" encoding; see the `wtf8` module for more.
3+
34
use crate::borrow::Cow;
45
use crate::collections::TryReserveError;
56
use crate::fmt;

0 commit comments

Comments
 (0)