diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 771c2d31b60e0..a25b631b9bd21 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1287,13 +1287,19 @@ pub(crate) mod builtin { /// Expands to the file name in which it was invoked. /// - /// With [`line!`] and [`column!`], these macros provide debugging information for - /// developers about the location within the source. - /// - /// The expanded expression has type `&'static str`, and the returned file - /// is not the invocation of the `file!` macro itself, but rather the - /// first macro invocation leading up to the invocation of the `file!` - /// macro. + /// With [`line!`] and [`column!`], these macros provide debugging information for developers + /// about the location within the source. + /// + /// The expanded expression has type `&'static str`, and the returned file is not the invocation + /// of the `file!` macro itself, but rather the first macro invocation leading up to the + /// invocation of the `file!` macro. + /// + /// The file name is derived from the root module's source path passed to the Rust compiler + /// (e.g. `./src/lib.rs`) and the sequence the compiler takes to get from root module to the + /// module containing `file!` (e.g. inside `mod foo;` in `./src/lib.rs`, `file!` would be + /// `./src/foo.rs`), modified by any flags passed to the Rust compiler (e.g. + /// `--remap-path-prefix`). If the source path is relative, the initial base directory will be + /// the working directory of the Rust compiler. /// /// # Examples ///