You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #155506 - jhpratt:rollup-tMDKAQS, r=jhpratt
Rollup of 9 pull requests
Successful merges:
- #155370 (Add regression test for dead code elimination with drop + panic)
- #154823 (Replace the spdx-rs dependency with a minimal in-tree SPDX tag-value parser)
- #154972 (Implement `core::arch::return_address` and tests)
- #155294 (Add test for coalescing of diagnostic attribute duplicates)
- #155352 (triagebot.toml: Sync `assign.owners` with `autolabel."T-compiler"`)
- #155431 (Add temporary scope to assert_matches)
- #152995 (ACP Implementation of PermissionsExt for Windows )
- #153873 (deprecate `std::char` constants and functions)
- #154865 (libtest: use binary search for --exact test filtering)
/// The `core::arch::return_address!()` macro returns a pointer with an address that corresponds to the caller of the function that invoked the `return_address!()` macro.
81
+
/// The pointer has no provenance, as if created by `core::ptr::without_provenance`. It cannot be used to read memory (other than ZSTs).
82
+
///
83
+
/// The value returned by the macro depends highly on the architecture and compiler (including any options set).
84
+
/// In particular, it is allowed to be wrong (particularly if inlining is involved), or even contain a nonsense value.
85
+
/// The result of this macro must not be relied upon for soundness or correctness, only for debugging purposes.
86
+
///
87
+
/// As a best effort, if a useful value cannot be determined (for example, due to limitations on the current codegen),
88
+
/// this macro tries to return a null pointer instead of nonsense (this cannot be relied upon for correctness, however).
89
+
///
90
+
/// Formally, this function returns a pointer with a non-deterministic address and no provenance.
91
+
///
92
+
/// This is equivalent to the gcc `__builtin_return_address(0)` intrinsic (other forms of the intrinsic are not supported).
93
+
/// Because the operation can be always performed by the compiler without crashing or causing undefined behaviour, invoking the macro is a safe operation.
/// Returns the return address of the caller function (after inlining) in a best-effort manner or a null pointer if it is not supported on the current backend.
3594
+
/// Returning an accurate value is a quality-of-implementation concern, but no hard guarantees are
3595
+
/// made about the return value: formally, the intrinsic non-deterministically returns
3596
+
/// an arbitrary pointer without provenance.
3597
+
///
3598
+
/// Note that unlike most intrinsics, this is safe to call. This is because it only finds the return address of the immediate caller, which is guaranteed to be possible.
3599
+
/// Other forms of the corresponding gcc or llvm intrinsic (which can have wildly unpredictable results or even crash at runtime) are not exposed.
0 commit comments