-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
panic_str only exists for the migration to 2021 panic macros #123050
Conversation
r? @m-ou-se |
rust/library/core/src/panic.rs Lines 30 to 33 in 60b5ca6
(See also the diagram in #116005) |
This comment has been minimized.
This comment has been minimized.
Ah, "find references" led me astray...
I originally just wanted to add some comments, I will probably turn the PR into that then. (Assuming that lint can't easily access type information.)
|
It seems like that lint does have type information available via |
☔ The latest upstream changes (presumably #123065) made this pull request unmergeable. Please resolve the merge conflicts. |
I guess that would not be right since the lint should kick in for |
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@m-ou-se I have updated the PR based on your comment. Do you want to take another look or should I try to find a different reviewer? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! r=me when ready.
This is ready, I just rebased to fix a typo in the commit message. :) @bors r=m-ou-se rollup |
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#123050 (panic_str only exists for the migration to 2021 panic macros) - rust-lang#124067 (weak lang items are not allowed to be #[track_caller]) - rust-lang#124099 (Disallow ambiguous attributes on expressions) - rust-lang#124284 (parser: remove unused(no reads) max_angle_bracket_count field) - rust-lang#124288 (remove `push_trait_bound_inner`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#123050 - RalfJung:panic_str, r=m-ou-se panic_str only exists for the migration to 2021 panic macros The only caller is `expect_failed`, which is already a cold inline(never) function, so inlining into that function should be fine. (And indeed `panic_str` was `#[inline]` anyway.) The existence of panic_str risks someone calling it when they should call `panic` instead, and I can't see a reason why this footgun should exist. I also extended the comment in `panic` to explain why it needs a `'static` string -- I know I've wondered about this in the past and it took me quite a while to understand.
The only caller is
expect_failed
, which is already a cold inline(never) function, so inlining into that function should be fine. (And indeedpanic_str
was#[inline]
anyway.)The existence of panic_str risks someone calling it when they should call
panic
instead, and I can't see a reason why this footgun should exist.I also extended the comment in
panic
to explain why it needs a'static
string -- I know I've wondered about this in the past and it took me quite a while to understand.