rust/library
Ed Page fea6a2289b Specify the behavior of file!
This takes the current behavior of `file!` and documents it so it is
safe to make assumptions about.
For example, Cargo could provide a `CARGO_RUSTC_CURRENT_DIR` as a base
path for `file!`.

Example use cases
- Being able to look up test assets relative to the current file
  ([example](b9026bf654/tests/testsuite/cargo_add/add_basic/mod.rs (L34)))
- Inline snapshotting libraries being able to update Rust source code
  ([example](b9026bf654/tests/testsuite/alt_registry.rs (L36-L45)))

T-libs-api discussed two solutions
- `file_absolute!`:
  - Has less meaning in other build tools like buck2
  - Bakes in the assumption that a full path is available (e.g. with
    trim-paths)
- Specifying `file!`s behavior (this PR):
  - Leaves it to the user to deal with trim-paths
  - Even though `file!` is currently unspecified, changing it would
    likely have too large of an impact on the ecosystem at this time.

A future possibility is that rustc could have a flag that controls
modifies the base path used for `file!`.
That seems purely additive with specifying the behavior and we do not
want to block on it.
It would also likely be too disruptive for Cargo users (as mentioned).
However, we tried to keep this in mind when specifying the behavior.
2025-06-09 15:25:26 -05:00
..
alloc remove extraneous text 2025-06-06 06:39:51 +02:00
alloctests Remove more library bootstrap 2025-06-02 14:46:19 -07:00
backtrace@6c882eb119 Fix backtrace for cygwin 2025-05-07 13:08:19 +08:00
compiler-builtins panic-handler: Remove the no_core feature 2025-06-04 21:27:00 +00:00
core Specify the behavior of file! 2025-06-09 15:25:26 -05:00
coretests Rollup merge of #141857 - RalfJung:coretests-floats, r=tgross35 2025-06-07 07:05:46 +02:00
panic_abort deduplicate abort implementations 2025-05-15 11:20:13 +02:00
panic_unwind intrinsics: use const generic to set atomic ordering 2025-06-07 21:45:58 +02:00
portable-simd Merge commit 'c14f2fc3eb' into sync-from-portable-simd-2025-03-19 2025-03-19 00:58:47 -04:00
proc_macro Do not get proc_macro from the sysroot in rustc 2025-05-27 15:49:28 +00:00
profiler_builtins Fix profiler_builtins build script to handle full path to profiler lib 2025-04-11 16:57:38 +02:00
rtstartup Revert changes for rtstartup 2025-03-10 21:23:31 +08:00
rustc-std-workspace-alloc Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
rustc-std-workspace-core Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
rustc-std-workspace-std Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
std Auto merge of #142242 - matthiaskrgr:rollup-1sgx0ji, r=matthiaskrgr 2025-06-09 12:21:14 +00:00
stdarch@5c1c436524 Update stdarch submodule 2025-06-03 18:54:56 +05:30
sysroot Update stdarch 2025-05-01 20:01:43 +05:30
test Add new test_main_with_exit_callback public function in libtest to allow a callback to be called before exiting 2025-05-06 18:17:48 +02:00
unwind Add new Tier-3 targets: loongarch32-unknown-none* 2025-06-06 08:19:38 +08:00
windows_targets Fix backtrace for cygwin 2025-05-07 13:08:19 +08:00
Cargo.lock Update compiler-builtins to 0.1.160 2025-05-30 16:09:12 +00:00
Cargo.toml Add opt-level = "s" for more std symbolication crates 2025-04-01 20:50:19 +00:00