Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for const_location_fields #102911

Closed
3 tasks done
lilasta opened this issue Oct 11, 2022 · 4 comments · Fixed by #122291
Closed
3 tasks done

Tracking Issue for const_location_fields #102911

lilasta opened this issue Oct 11, 2022 · 4 comments · Fixed by #122291
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@lilasta
Copy link
Contributor

lilasta commented Oct 11, 2022

Feature gate: #![feature(const_location_fields)]

This is a tracking issue for core::panic::Location methods as const functions.

Public API

// core::panic::location
impl Location {
    pub const fn file(&self) -> &str;
    pub const fn line(&self) -> u32;
    pub const fn column(&self) -> u32;
}

Steps / History

Unresolved Questions

  • None yet.
@lilasta lilasta added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 11, 2022
lyming2007 pushed a commit to lyming2007/rust that referenced this issue Oct 21, 2022
@programmerjake
Copy link
Member

anything needed before both this and #76156 can be stabilized?

@lilasta
Copy link
Contributor Author

lilasta commented Feb 25, 2024

@programmerjake I think there is no blocker for stabilization since the functions just return a field value.
However, I'm not sure if Location::caller can be stabilized. Additional testing is probably needed regarding its use in const generic parameters, macros, and so on.

@Dylan-DPC
Copy link
Member

@programmerjake @lilasta doesn't seem to be any blockers here and this has sat long enough so all what's missing is someone sending the pr to stabilise it, so feel free to do so if you are interested

@Amanieu
Copy link
Member

Amanieu commented Mar 22, 2024

FCP started in #76156 which also covers this issue.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 6, 2024
…ields, 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;
}
```
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 6, 2024
…ields, 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;
}
```
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 6, 2024
…ields, 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;
}
```
@bors bors closed this as completed in cb7f1ee Apr 6, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 6, 2024
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;
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants