Repository: rust
Issue: Doctest doesn't print valid assert file line and column location link
Labels: T-rustdoc,C-enhancement,A-doctests

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

I tried this code:

```rust
//! Tools for encoding and decoding instructions into and from an intuitive structure.
//! 
//! ERROR HAPPENS ON THIS LINE??: The instruction encoding and decoding format involved an intermediate format. Instructions involve 2 mandatory 
//! driver b.... 

struct SomethingToTakeLines {
// a // Rust says error happend here or so
// b
}

impl Driver {
	/// TODO: Implement test
	/// ```
	/// assert!(false); // Target should be here. 
	/// ```
	pub fn from_encoded(bytes: [u8; 2]) -> Self { ... }
}
```

I expected to see this happen: 
I expected a link to line 1 of the doctest

Instead, this happened: 
Line 3 of the entire parent file.
```
assertion failed: false
thread 'main' panicked at src\processor\src\instruction.rs:3:1:

```

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.77.0-nightly (e51e98dde 2023-12-31)
binary: rustc
commit-hash: e51e98dde6a60637b6a71b8105245b629ac3fe77
commit-date: 2023-12-31
host: x86_64-pc-windows-msvc
release: 1.77.0-nightly
LLVM version: 17.0.6

```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary>Backtrace</summary>
<p>

```
"C:/Users/Rayyan Khan/.cargo/bin/cargo.exe" test --color=always --doc "instruction::from_encoded\ (line\ 69)" --no-fail-fast --manifest-path "C:\Users\Rayyan Khan\Desktop\The Four Elements\Processor\src\processor\Cargo.toml" -- --format=json -Z unstable-options --show-output
Testing started at 11:34 PM ...
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
   Compiling atln-processor v0.1.0 (C:\Users\Rayyan Khan\Desktop\The Four Elements\Processor\src\processor)
warning: unused variable: `memory`
  --> src\processor\src\lib.rs:41:52
   |
41 |     pub fn execute(&mut self, stream: &mut impl Read, memory: &mut Memory) -> Result<(), ExecuteError> {
   |                                                       ^^^^^^ help: if this is intentional, prefix it with an underscore: `_memory`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: `atln-processor` (lib) generated 1 warning (run `cargo fix --lib -p atln-processor` to apply 1 suggestion)
    Finished test [unoptimized + debuginfo] target(s) in 1.12s
   Doc-tests atln-processor
Test executable failed (exit code: 101).

stderr:

assertion failed: false
thread 'main' panicked at src\processor\src\instruction.rs:3:1:
assertion failed: false
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library\std\src\panicking.rs:645
   1: core::panicking::panic_fmt
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library\core\src\panicking.rs:72
   2: core::panicking::panic
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library\core\src\panicking.rs:144
   3: std::rt::lang_start
   4: std::rt::lang_start
   5: std::rt::lang_start
   6: __ImageBase
   7: std::rt::lang_start
   8: std::rt::lang_start_internal::closure$2
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library\std\src\rt.rs:148
   9: std::panicking::try::do_call
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library\std\src\panicking.rs:552
  10: std::panicking::try
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library\std\src\panicking.rs:516
  11: std::panic::catch_unwind
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library\std\src\panic.rs:142
  12: std::rt::lang_start_internal
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library\std\src\rt.rs:148
  13: std::rt::lang_start
  14: main
  15: invoke_main
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  16: __scrt_common_main_seh
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  17: BaseThreadInitThunk
  18: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


error: doctest failed, to rerun pass `--doc`
error: 1 target failed:
    `--doc`

Process finished with exit code 101

```

</p>
</details>