Skip to content

Commit 7385447

Browse files
authored
Rollup merge of rust-lang#122291 - lilasta:stabilize_const_location_fields, r=dtolnay
Stabilize `const_caller_location` and `const_location_fields` Closes rust-lang#102911. Closes rust-lang#76156. tests: [library/core/tests/panic/location.rs](https://github.com/rust-lang/rust/blob/3521a2f2f317cb978063842485c7d1bc86ec82b6/library/core/tests/panic/location.rs) API: ```rust // core::panic::location impl Location { pub const fn caller() -> &'static Location<'static>; pub const fn file(&self) -> &str; pub const fn line(&self) -> u32; pub const fn column(&self) -> u32; } ```
2 parents e6d7439 + 8fcb41e commit 7385447

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

core/src/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ extern "rust-intrinsic" {
11281128
/// any safety invariants.
11291129
///
11301130
/// Consider using [`core::panic::Location::caller`] instead.
1131-
#[rustc_const_unstable(feature = "const_caller_location", issue = "76156")]
1131+
#[rustc_const_stable(feature = "const_caller_location", since = "CURRENT_RUSTC_VERSION")]
11321132
#[rustc_safe_intrinsic]
11331133
#[rustc_nounwind]
11341134
pub fn caller_location() -> &'static crate::panic::Location<'static>;

core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@
125125
#![feature(const_array_into_iter_constructors)]
126126
#![feature(const_bigint_helper_methods)]
127127
#![feature(const_black_box)]
128-
#![feature(const_caller_location)]
129128
#![feature(const_cell_into_inner)]
130129
#![feature(const_char_from_u32_unchecked)]
131130
#![feature(const_eval_select)]

core/src/panic/location.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<'a> Location<'a> {
8181
/// ```
8282
#[must_use]
8383
#[stable(feature = "track_caller", since = "1.46.0")]
84-
#[rustc_const_unstable(feature = "const_caller_location", issue = "76156")]
84+
#[rustc_const_stable(feature = "const_caller_location", since = "CURRENT_RUSTC_VERSION")]
8585
#[track_caller]
8686
#[inline]
8787
pub const fn caller() -> &'static Location<'static> {
@@ -123,7 +123,7 @@ impl<'a> Location<'a> {
123123
/// ```
124124
#[must_use]
125125
#[stable(feature = "panic_hooks", since = "1.10.0")]
126-
#[rustc_const_unstable(feature = "const_location_fields", issue = "102911")]
126+
#[rustc_const_stable(feature = "const_location_fields", since = "CURRENT_RUSTC_VERSION")]
127127
#[inline]
128128
pub const fn file(&self) -> &str {
129129
self.file
@@ -148,7 +148,7 @@ impl<'a> Location<'a> {
148148
/// ```
149149
#[must_use]
150150
#[stable(feature = "panic_hooks", since = "1.10.0")]
151-
#[rustc_const_unstable(feature = "const_location_fields", issue = "102911")]
151+
#[rustc_const_stable(feature = "const_location_fields", since = "CURRENT_RUSTC_VERSION")]
152152
#[inline]
153153
pub const fn line(&self) -> u32 {
154154
self.line
@@ -173,7 +173,7 @@ impl<'a> Location<'a> {
173173
/// ```
174174
#[must_use]
175175
#[stable(feature = "panic_col", since = "1.25.0")]
176-
#[rustc_const_unstable(feature = "const_location_fields", issue = "102911")]
176+
#[rustc_const_stable(feature = "const_location_fields", since = "CURRENT_RUSTC_VERSION")]
177177
#[inline]
178178
pub const fn column(&self) -> u32 {
179179
self.col

core/tests/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![feature(const_align_offset)]
1212
#![feature(const_align_of_val_raw)]
1313
#![feature(const_black_box)]
14-
#![feature(const_caller_location)]
1514
#![feature(const_cell_into_inner)]
1615
#![feature(const_hash)]
1716
#![feature(const_heap)]
@@ -25,7 +24,6 @@
2524
#![cfg_attr(not(bootstrap), feature(const_three_way_compare))]
2625
#![feature(const_trait_impl)]
2726
#![feature(const_likely)]
28-
#![feature(const_location_fields)]
2927
#![feature(core_intrinsics)]
3028
#![feature(core_io_borrowed_buf)]
3129
#![feature(core_private_bignum)]

0 commit comments

Comments
 (0)