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

Fix overly restrictive lifetime in core::panic::Location::file return type #132087

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ijchen
Copy link
Contributor

@ijchen ijchen commented Oct 24, 2024

Fixes #131770 by relaxing the lifetime to match what's stored in the struct. See that issue for more details and discussion.

Since this is a breaking change, I think a crater run is in order. Since this change should only have an effect at compile-time, I think just a check run is sufficient.

@rustbot
Copy link
Collaborator

rustbot commented Oct 24, 2024

r? @cuviper

rustbot has assigned @cuviper.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 24, 2024
Copy link
Contributor

@SpriteOvO SpriteOvO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe adding a regression test in library/core/tests/panic/location.rs would be nice.

@ijchen
Copy link
Contributor Author

ijchen commented Oct 24, 2024

Maybe adding a regression test in library/core/tests/panic/location.rs would be nice.

That's a great idea! I'll implement that.

UPDATE: Implemented. It's a bit of a strange test, since it fails through a compiler error instead of a runtime panic, but I think that's necessary considering lifetimes and the borrow checker only exists at compile time.

@cuviper
Copy link
Member

cuviper commented Oct 24, 2024

Hmm, this is "overly restrictive" in the current implementation, but sometimes that's on purpose to give implementation freedom. For instance, we couldn't use Cow<'a, str> internally after your change. (ignoring core/alloc for a moment)

The breaking change of the function type is unlikely to be a problem IMO, but the API team should review it overall.

@rustbot label -T-libs +T-libs-api
r? libs-api

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 24, 2024
@rustbot rustbot assigned m-ou-se and unassigned cuviper Oct 24, 2024
@bors
Copy link
Contributor

bors commented Jan 27, 2025

☔ The latest upstream changes (presumably #135937) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC Dylan-DPC added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overly restrictive lifetime in std::panic::Location::file
7 participants