Skip to content

Commit 99f879c

Browse files
authored
Document the column numbers for the dbg! macro
The line numbers were also made consistent, some examples used the line numbers as shown on the playground while others used the line numbers that you would expect when just seeing the documentation. The second option was chosen to make everything consistent.
1 parent cb12b52 commit 99f879c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

library/std/src/macros.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ macro_rules! eprintln {
230230
/// ```rust
231231
/// let a = 2;
232232
/// let b = dbg!(a * 2) + 1;
233-
/// // ^-- prints: [src/main.rs:2] a * 2 = 4
233+
/// // ^-- prints: [src/main.rs:2:9] a * 2 = 4
234234
/// assert_eq!(b, 5);
235235
/// ```
236236
///
@@ -281,7 +281,7 @@ macro_rules! eprintln {
281281
/// This prints to [stderr]:
282282
///
283283
/// ```text,ignore
284-
/// [src/main.rs:4] n.checked_sub(4) = None
284+
/// [src/main.rs:2:22] n.checked_sub(4) = None
285285
/// ```
286286
///
287287
/// Naive factorial implementation:
@@ -301,15 +301,15 @@ macro_rules! eprintln {
301301
/// This prints to [stderr]:
302302
///
303303
/// ```text,ignore
304-
/// [src/main.rs:3] n <= 1 = false
305-
/// [src/main.rs:3] n <= 1 = false
306-
/// [src/main.rs:3] n <= 1 = false
307-
/// [src/main.rs:3] n <= 1 = true
308-
/// [src/main.rs:4] 1 = 1
309-
/// [src/main.rs:5] n * factorial(n - 1) = 2
310-
/// [src/main.rs:5] n * factorial(n - 1) = 6
311-
/// [src/main.rs:5] n * factorial(n - 1) = 24
312-
/// [src/main.rs:11] factorial(4) = 24
304+
/// [src/main.rs:2:8] n <= 1 = false
305+
/// [src/main.rs:2:8] n <= 1 = false
306+
/// [src/main.rs:2:8] n <= 1 = false
307+
/// [src/main.rs:2:8] n <= 1 = true
308+
/// [src/main.rs:3:9] 1 = 1
309+
/// [src/main.rs:7:9] n * factorial(n - 1) = 2
310+
/// [src/main.rs:7:9] n * factorial(n - 1) = 6
311+
/// [src/main.rs:7:9] n * factorial(n - 1) = 24
312+
/// [src/main.rs:9:1] factorial(4) = 24
313313
/// ```
314314
///
315315
/// The `dbg!(..)` macro moves the input:

0 commit comments

Comments
 (0)