Skip to content

Commit 3352dfc

Browse files
committed
Skip formatting for some compiler documentation code
These examples feature Rust code that's presented primarily to illustrate how its compilation would be handled, and these examples are formatted to highlight those aspects in ways that rustfmt wouldn't preserve. Turn formatting off in those examples. (Doc code isn't formatted yet, but this will make it easier to enable doc code formatting in the future.)
1 parent 29a5872 commit 3352dfc

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
417417
/// minimum values.
418418
///
419419
/// For example:
420-
/// ```
420+
/// ```ignore (illustrative)
421421
/// fn foo<'a, 'b>( /* ... */ ) where 'a: 'b { /* ... */ }
422422
/// ```
423423
/// would initialize two variables like so:

compiler/rustc_hir/src/def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl DefKind {
356356
/// For example, everything prefixed with `/* Res */` in this example has
357357
/// an associated `Res`:
358358
///
359-
/// ```
359+
/// ```ignore (illustrative)
360360
/// fn str_to_string(s: & /* Res */ str) -> /* Res */ String {
361361
/// /* Res */ String::from(/* Res */ s)
362362
/// }

compiler/rustc_mir_dataflow/src/impls/initialized.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ impl<'tcx> MaybePlacesSwitchIntData<'tcx> {
108108
///
109109
/// ```rust
110110
/// struct S;
111+
/// #[rustfmt::skip]
111112
/// fn foo(pred: bool) { // maybe-init:
112113
/// // {}
113114
/// let a = S; let mut b = S; let c; let d; // {a, b}
@@ -197,6 +198,7 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'tcx> {
197198
///
198199
/// ```rust
199200
/// struct S;
201+
/// #[rustfmt::skip]
200202
/// fn foo(pred: bool) { // maybe-uninit:
201203
/// // {a, b, c, d}
202204
/// let a = S; let mut b = S; let c; let d; // { c, d}
@@ -289,6 +291,7 @@ impl<'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
289291
///
290292
/// ```rust
291293
/// struct S;
294+
/// #[rustfmt::skip]
292295
/// fn foo(pred: bool) { // ever-init:
293296
/// // { }
294297
/// let a = S; let mut b = S; let c; let d; // {a, b }

0 commit comments

Comments
 (0)