-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
core::panic!() cannot be used everywhere std::panic!() can. #80846
Comments
#80848 is an attempt at fixing this, by adding But as mentioned in #80848 (comment), the braces were not added in Is this a bug? Should this behave the same with and without those braces? |
The never type never ceases to surprise, does it? cc @nikomatsakis I'd be worried about changing typeck behavior here, personally, I'm not even sure it would survive crater, and could have subtler implications still. Adding the braces to |
Implement Rust 2021 panic This implements the Rust 2021 versions of `panic!()`. See rust-lang#80162 and rust-lang/rfcs#3007. It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller. This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: rust-lang@c5273bd That change is blocked on figuring out what to do with rust-lang#80846 first.
Implement Rust 2021 panic This implements the Rust 2021 versions of `panic!()`. See rust-lang/rust#80162 and rust-lang/rfcs#3007. It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller. This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: rust-lang/rust@c5273bd That change is blocked on figuring out what to do with rust-lang/rust#80846 first.
I see that #80162, which listed this issue as a blocker, has been closed. Does that mean this can be closed too? |
For that PR we decided to just change it for edition 2021, but this problem still exists in the current editions. It's not a big problem, but it'd be good to figure out why this difference exists. |
Closing this issue because I don't care enough, especially since this problem is no longer there in edition 2021. If anyone does care about this issue in edition 2015/2018, feel free to re-open. |
This compiles:
This does not:
The cause seems to be that
std::panic!()
expands to{ some_function(..) }
whilecore::panic!()
expands tosome_function(..)
, without{ .. }
. Adding{ .. }
in thecore::panic!()
macro_rules
'fixes' it.The text was updated successfully, but these errors were encountered: