panic_str only exists for the migration to 2021 panic macros#123050
panic_str only exists for the migration to 2021 panic macros#123050bors merged 2 commits intorust-lang:masterfrom
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? |
|
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_strwas#[inline]anyway.)The existence of panic_str risks someone calling it when they should call
panicinstead, and I can't see a reason why this footgun should exist.I also extended the comment in
panicto explain why it needs a'staticstring -- I know I've wondered about this in the past and it took me quite a while to understand.