Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5b2c61e
Document guarantees of poisoning
purplesyringa Jul 19, 2025
45231fa
[rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.
obi1kenobi Jul 23, 2025
5ae2d42
get rid of some false negatives in rustdoc::broken_intra_doc_links
lolbinarycat Nov 7, 2024
87d7d80
adjust more unit tests to reflect more aggressive intra-doc linting
lolbinarycat Nov 8, 2024
a7da4b8
rustdoc::broken_intra_doc_links: no backticks = use old behavior
lolbinarycat Apr 18, 2025
0413481
rustdoc: update tests to match new lint behavior
lolbinarycat Apr 18, 2025
6a7d488
rustdoc::broken_intra_doc_links: only be lenient with shortcut links
lolbinarycat Apr 19, 2025
bd85df1
move bad-intra-doc test into intra-doc dir
lolbinarycat Apr 19, 2025
a73d7e3
fix up issues with internal compiler docs revealed by stricter lint
lolbinarycat Jul 24, 2025
da4687b
Link to Mutex poisoning docs from RwLock docs
purplesyringa Jul 25, 2025
5b8c614
Add a list of failure conditions for poisoning
purplesyringa Jul 25, 2025
c1d06cc
Add a note on foreign exceptions
purplesyringa Jul 25, 2025
3352dfc
Skip formatting for some compiler documentation code
joshtriplett Jul 26, 2025
7150880
Improve and regularize comment placement in doc code
joshtriplett Jul 26, 2025
b6c54a9
Avoid placing `// FIXME` comments inside doc code blocks
joshtriplett Jul 26, 2025
56c5b1d
Add parentheses around expression arguments to `..`
joshtriplett Jul 26, 2025
1e2d587
Avoid making the start of a doc code block conditional
joshtriplett Jul 26, 2025
91bccd6
use `minicore` for fortanix assembly tests
folkertdev Jul 24, 2025
8b90847
update fortanix run-make test
folkertdev Jul 24, 2025
0e53d85
Fortify RemoveUnneededDrops test.
cjgillot Jun 16, 2025
ede338c
WIP: auth using GitHub app
Kobzol Jul 29, 2025
7e4ded4
Remove `bot-pull-requests` triagebot config
Kobzol Jul 29, 2025
ad28843
Merge pull request #2521 from rust-lang/ci-gh-app
Kobzol Jul 29, 2025
6a40a17
Use main branch of josh-sync for CI workflow
Kobzol Jul 29, 2025
dc17d35
Merge pull request #2523 from Kobzol/ci-main
Kobzol Jul 29, 2025
951a6f7
Remove outdated ci.py reference
Kobzol Jul 30, 2025
bfdef36
Merge pull request #2525 from Kobzol/remove-ci-py
Kobzol Jul 30, 2025
ee0118f
[test][AIX] ignore extern_weak linkage test
daltenty Jul 30, 2025
7d37819
Prepare for merging from rust-lang/rust
invalid-email-address Jul 31, 2025
7cab27d
Merge ref '32e7a4b92b10' from rust-lang/rust
invalid-email-address Jul 31, 2025
cab1643
improve linking in the "Auxilirary builds" section of directive index
lolbinarycat Jul 31, 2025
5aec437
detect infinite recursion with tail calls in ctfe
WaffleLapkin Jul 31, 2025
040f71e
loop match: error on `#[const_continue]` outside `#[loop_match]`
folkertdev Jul 25, 2025
f909918
Add human readable name "Cygwin"
Berrysoft Aug 1, 2025
9377e0a
Constify additional Result functions
Randl Aug 1, 2025
f7267cc
Merge pull request #2527 from lolbinarycat/patch-5
jieyouxu Aug 1, 2025
4f60c90
rarw
lcnr Aug 1, 2025
c277f4e
Merge pull request #2529 from lcnr/type-system-invariants
lcnr Aug 1, 2025
bd7b8b3
Properly pass path to staged `rustc` to `compiletest` self-tests
jieyouxu Aug 1, 2025
ba57bba
rarw
lcnr Aug 1, 2025
219e4c1
Merge pull request #2530 from lcnr/type-system-invariants
lcnr Aug 1, 2025
d5ffb06
compiletest: Improve diagnostics for line annotation mismatches 2
petrochenkov Jul 31, 2025
32cf3d4
Cleanup the definition of `group_type`
JonathanBrouwer Aug 1, 2025
21ab47e
Add my previous commit name to .mailmap
scrabsha Aug 1, 2025
4c7c9de
Fix safety comment for new_unchecked in niche_types
nilehmann Aug 1, 2025
171c247
Merge pull request #2526 from rust-lang/rustc-pull
tshepang Aug 1, 2025
fc4b3fa
Rollup merge of #132748 - lolbinarycat:rustdoc-intra-doc-link-warn-mo…
samueltardieu Aug 2, 2025
93917ea
Rollup merge of #143360 - folkertdev:const-continue-outside-loop-matc…
samueltardieu Aug 2, 2025
4eddebd
Rollup merge of #143662 - obi1kenobi:pg/unsafe-attribute-wrappers, r=…
samueltardieu Aug 2, 2025
96b3b83
Rollup merge of #143771 - Randl:const-result, r=tgross35
samueltardieu Aug 2, 2025
ce1961b
Rollup merge of #144185 - purplesyringa:poisoning-wording, r=Amanieu
samueltardieu Aug 2, 2025
cafd9fb
Rollup merge of #144395 - folkertdev:fortanix-run-make-test, r=jieyouxu
samueltardieu Aug 2, 2025
d082ff4
Rollup merge of #144478 - joshtriplett:doc-code-formatting-prep, r=Am…
samueltardieu Aug 2, 2025
37ec453
Rollup merge of #144614 - cjgillot:fortify-unneeded, r=scottmcm
samueltardieu Aug 2, 2025
751ee2a
Rollup merge of #144703 - daltenty:daltenty/extern-weak, r=Noratrieb
samueltardieu Aug 2, 2025
7e8ef3a
Rollup merge of #144747 - petrochenkov:annusexp2, r=RalfJung
samueltardieu Aug 2, 2025
179b4b6
Rollup merge of #144756 - WaffleLapkin:inf-rec-etc-ctfe, r=lqd
samueltardieu Aug 2, 2025
5b81184
Rollup merge of #144766 - Berrysoft:patch-1, r=GuillaumeGomez
samueltardieu Aug 2, 2025
7a64c13
Rollup merge of #144782 - jieyouxu:compiletest-selftests, r=Kobzol
samueltardieu Aug 2, 2025
c4b0fb7
Rollup merge of #144786 - JonathanBrouwer:cleanup-group-type, r=jdons…
samueltardieu Aug 2, 2025
5bcc7c2
Rollup merge of #144796 - scrabsha:push-lsnwwpwpnpxr, r=jdonszelmann
samueltardieu Aug 2, 2025
5e1ea9c
Rollup merge of #144797 - nilehmann:safety-comment-niche, r=Noratrieb
samueltardieu Aug 2, 2025
0fcfb8b
Rollup merge of #144803 - tshepang:rdg-sync, r=jieyouxu
samueltardieu Aug 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve and regularize comment placement in doc code
Because doc code does not get automatically formatted, some doc code has
creative placements of comments that automatic formatting can't handle.
Reformat those comments to make the resulting code support standard Rust
formatting without breaking; this is generally an improvement to
readability as well.

Some comments are not indented to the prevailing indent, and are instead
aligned under some bit of code. Indent them to the prevailing indent,
and put spaces *inside* the comments to align them with code.

Some comments span several lines of code (which aren't the line the
comment is about) and expect alignment. Reformat them into one comment
not broken up by unrelated intervening code.

Some comments are placed on the same line as an opening brace, placing
them effectively inside the subsequent block, such that formatting would
typically format them like a line of that block. Move those comments to
attach them to what they apply to.

Some comments are placed on the same line as a one-line braced block,
effectively attaching them to the closing brace, even though they're
about the code inside the block. Reformat to make sure the comment will
stay on the same line as the code it's commenting.
  • Loading branch information
joshtriplett committed Jul 26, 2025
commit 715088094c2e2ef31158b4767ceacfba62c8e6ef
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ pub enum Res<Id = hir::HirId> {
/// }
///
/// impl Foo for Bar {
/// fn foo() -> Box<Self> { // SelfTyAlias
/// fn foo() -> Box<Self /* SelfTyAlias */> {
/// let _: Self; // SelfTyAlias
///
/// todo!()
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RemapLateParam<'tcx> {
///
/// trait Foo {
/// fn bar() -> impl Deref<Target = impl Sized>;
/// // ^- RPITIT #1 ^- RPITIT #2
/// // ^- RPITIT #1 ^- RPITIT #2
/// }
///
/// impl Foo for () {
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_hir_typeck/src/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2391,13 +2391,11 @@ fn migration_suggestion_for_2229(
/// let mut p = Point { x: 10, y: 10 };
///
/// let c = || {
/// p.x += 10;
/// // ^ E1 ^
/// p.x += 10; // E1
/// // ...
/// // More code
/// // ...
/// p.x += 10; // E2
/// // ^ E2 ^
/// };
/// ```
/// `CaptureKind` associated with both `E1` and `E2` will be ByRef(MutBorrow),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
//! fn bar<T>(a: T, b: impl for<'a> Fn(&'a T)) {}
//! fn foo<T>(x: T) {
//! bar(x, |y| { /* ... */})
//! // ^ closure arg
//! // ^ closure arg
//! }
//! ```
//!
Expand Down
12 changes: 8 additions & 4 deletions compiler/rustc_middle/src/hir/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,10 @@ impl<'tcx> TyCtxt<'tcx> {
/// ```
/// fn foo(x: usize) -> bool {
/// if x == 1 {
/// true // If `get_fn_id_for_return_block` gets passed the `id` corresponding
/// } else { // to this, it will return `foo`'s `HirId`.
/// // If `get_fn_id_for_return_block` gets passed the `id` corresponding to this, it
/// // will return `foo`'s `HirId`.
/// true
/// } else {
/// false
/// }
/// }
Expand All @@ -543,8 +545,10 @@ impl<'tcx> TyCtxt<'tcx> {
/// ```compile_fail,E0308
/// fn foo(x: usize) -> bool {
/// loop {
/// true // If `get_fn_id_for_return_block` gets passed the `id` corresponding
/// } // to this, it will return `None`.
/// // If `get_fn_id_for_return_block` gets passed the `id` corresponding to this, it
/// // will return `None`.
/// true
/// }
/// false
/// }
/// ```
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,8 @@ pub struct LocalDecl<'tcx> {
/// ```
/// fn foo(x: &str) {
/// #[allow(unused_mut)]
/// let mut x: u32 = { // <- one unused mut
/// let mut x: u32 = {
/// //^ one unused mut
/// let mut y: u32 = x.parse().unwrap();
/// y + 2
/// };
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_mir_build/src/builder/expr/as_operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
/// ```
/// #![feature(unsized_fn_params)]
/// # use core::fmt::Debug;
/// fn foo(_p: dyn Debug) { /* ... */ }
/// fn foo(_p: dyn Debug) {
/// /* ... */
/// }
///
/// fn bar(box_p: Box<dyn Debug>) { foo(*box_p); }
/// ```
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_span/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,9 @@ impl SyntaxContext {
///
/// ```rust
/// #![feature(decl_macro)]
/// mod foo { pub fn f() {} } // `f`'s `SyntaxContext` is empty.
/// mod foo {
/// pub fn f() {} // `f`'s `SyntaxContext` is empty.
/// }
/// m!(f);
/// macro m($f:ident) {
/// mod bar {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_thread_pool/src/scope/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,9 @@ impl<'scope> Scope<'scope> {
/// let mut value_c = None;
/// rayon::scope(|s| {
/// s.spawn(|s1| {
/// // ^ this is the same scope as `s`; this handle `s1`
/// // is intended for use by the spawned task,
/// // since scope handles cannot cross thread boundaries.
/// // ^ this is the same scope as `s`; this handle `s1`
/// // is intended for use by the spawned task,
/// // since scope handles cannot cross thread boundaries.
///
/// value_a = Some(22);
///
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3778,8 +3778,8 @@ impl<T, A: Allocator> Vec<T, A> {
/// while i < vec.len() - end_items {
/// if some_predicate(&mut vec[i]) {
/// let val = vec.remove(i);
/// # extracted.push(val);
/// // your code here
/// # extracted.push(val);
/// } else {
/// i += 1;
/// }
Expand Down
6 changes: 3 additions & 3 deletions library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2068,9 +2068,9 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
/// implies exclusive access to its `T`:
///
/// ```rust
/// #![forbid(unsafe_code)] // with exclusive accesses,
/// // `UnsafeCell` is a transparent no-op wrapper,
/// // so no need for `unsafe` here.
/// #![forbid(unsafe_code)]
/// // with exclusive accesses, `UnsafeCell` is a transparent no-op wrapper, so no need for
/// // `unsafe` here.
/// use std::cell::UnsafeCell;
///
/// let mut x: UnsafeCell<i32> = 42.into();
Expand Down
2 changes: 0 additions & 2 deletions library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,6 @@ pub const fn must_use<T>(value: T) -> T {
/// }
/// }
/// ```
///
///
#[unstable(feature = "likely_unlikely", issue = "136873")]
#[inline(always)]
pub const fn likely(b: bool) -> bool {
Expand Down
6 changes: 4 additions & 2 deletions library/core/src/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@
//!
//! ```
//! let mut values = vec![41];
//! for x in &mut values { // same as `values.iter_mut()`
//! for x in &mut values {
//! // ^ same as `values.iter_mut()`
//! *x += 1;
//! }
//! for x in &values { // same as `values.iter()`
//! for x in &values {
//! // ^ same as `values.iter()`
//! assert_eq!(*x, 42);
//! }
//! assert_eq!(values.len(), 1);
Expand Down
10 changes: 8 additions & 2 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ pub macro cfg_select($($tt:tt)*) {
/// // expression given.
/// debug_assert!(true);
///
/// fn some_expensive_computation() -> bool { true } // a very simple function
/// fn some_expensive_computation() -> bool {
/// // Some expensive computation here
/// true
/// }
/// debug_assert!(some_expensive_computation());
///
/// // assert with a custom message
Expand Down Expand Up @@ -1545,7 +1548,10 @@ pub(crate) mod builtin {
/// // expression given.
/// assert!(true);
///
/// fn some_computation() -> bool { true } // a very simple function
/// fn some_computation() -> bool {
/// // Some expensive computation here
/// true
/// }
///
/// assert!(some_computation());
///
Expand Down
3 changes: 1 addition & 2 deletions library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ unsafe impl<T: Sync + PointeeSized> Send for &T {}
/// impl Bar for Impl { }
///
/// let x: &dyn Foo = &Impl; // OK
/// // let y: &dyn Bar = &Impl; // error: the trait `Bar` cannot
/// // be made into an object
/// // let y: &dyn Bar = &Impl; // error: the trait `Bar` cannot be made into an object
/// ```
///
/// [trait object]: ../../book/ch17-02-trait-objects.html
Expand Down
21 changes: 10 additions & 11 deletions library/core/src/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,7 @@ impl<T> MaybeUninit<T> {
/// // Initialize the `MaybeUninit` using `Cell::set`:
/// unsafe {
/// b.assume_init_ref().set(true);
/// // ^^^^^^^^^^^^^^^
/// // Reference to an uninitialized `Cell<bool>`: UB!
/// //^^^^^^^^^^^^^^^ Reference to an uninitialized `Cell<bool>`: UB!
/// }
/// ```
#[stable(feature = "maybe_uninit_ref", since = "1.55.0")]
Expand Down Expand Up @@ -864,9 +863,9 @@ impl<T> MaybeUninit<T> {
/// {
/// let mut buffer = MaybeUninit::<[u8; 64]>::uninit();
/// reader.read_exact(unsafe { buffer.assume_init_mut() })?;
/// // ^^^^^^^^^^^^^^^^^^^^^^^^
/// // (mutable) reference to uninitialized memory!
/// // This is undefined behavior.
/// // ^^^^^^^^^^^^^^^^^^^^^^^^
/// // (mutable) reference to uninitialized memory!
/// // This is undefined behavior.
/// Ok(unsafe { buffer.assume_init() })
/// }
/// ```
Expand All @@ -884,13 +883,13 @@ impl<T> MaybeUninit<T> {
/// let foo: Foo = unsafe {
/// let mut foo = MaybeUninit::<Foo>::uninit();
/// ptr::write(&mut foo.assume_init_mut().a as *mut u32, 1337);
/// // ^^^^^^^^^^^^^^^^^^^^^
/// // (mutable) reference to uninitialized memory!
/// // This is undefined behavior.
/// // ^^^^^^^^^^^^^^^^^^^^^
/// // (mutable) reference to uninitialized memory!
/// // This is undefined behavior.
/// ptr::write(&mut foo.assume_init_mut().b as *mut u8, 42);
/// // ^^^^^^^^^^^^^^^^^^^^^
/// // (mutable) reference to uninitialized memory!
/// // This is undefined behavior.
/// // ^^^^^^^^^^^^^^^^^^^^^
/// // (mutable) reference to uninitialized memory!
/// // This is undefined behavior.
/// foo.assume_init()
/// };
/// ```
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ impl<T, E> Result<T, E> {
///
/// ```no_run
/// let x: Result<u32, &str> = Err("emergency failure");
/// unsafe { x.unwrap_unchecked(); } // Undefined behavior!
/// unsafe { x.unwrap_unchecked() }; // Undefined behavior!
/// ```
#[inline]
#[track_caller]
Expand Down