Uh oh!
There was an error while loading. Please reload this page.
Expand core::panic!() to always include { .. }. - #80848
Conversation
std::panic!() always expanded to a `{..}` block, but core::panic!() did
not. Because of this subtle difference, the issue-5500-1 test passed
for std::panic!(), but not for core::panic!().
This makes them behave the same, and extends that test to also check
core::panic!().rust-highfive
commented
Jan 9, 2021
(rust-highfive has picked a reviewer for you, use r? to override) |
petrochenkov
commented
Jan 9, 2021
The braces were added to So I'd rather remove the braces from the |
m-ou-se
commented
Jan 9, 2021
@petrochenkov If I remove the braces, // check-passstructTrieMapIterator<'a>{node:&'ausize}fnmain(){let a = 5;let _iter = TrieMapIterator{node:&a};
_iter.node = &panic!()}Is that a bug? |
petrochenkov
commented
Jan 9, 2021
At least the original issue #5500 was about invalid code producing an ICE rather than about valid code not compiling, so the test requiring the braces is accidental to the same degree as the commit that introduced the braces. |
m-ou-se
commented
Jan 9, 2021
It also makes I suppose |
eddyb
commented
Jan 11, 2021
@petrochenkov Regardless of that, this would change the type-checking behavior of |
petrochenkov
commented
Jan 23, 2021
petrochenkov
commented
Jan 23, 2021
Are there cases in which adding the braces to panic breaks code? We should drop the braces in the 2021-edition panic though, since we are changing its behavior anyway. |
bors
commented
Jan 23, 2021
📌 Commit 9178bf2 has been approved by |
Mark-Simulacrum
commented
Jan 23, 2021
@bors rollup=never for easier bisection and perf |
bors
commented
Jan 24, 2021
⌛ Testing commit 9178bf2 with merge e8b203f744aef93d4f7a31907249ccc936cb4b75... |
rust-log-analyzer
commented
Jan 24, 2021
The job Click to see the possible cause of the failure (guessed by this bot) |
bors
commented
Jan 24, 2021
💔 Test failed - checks-actions |
petrochenkov
commented
Jan 24, 2021
Looks like |
jonas-schievink
commented
Jan 30, 2021
@bors r- |
bors
commented
Jan 30, 2021
⌛ Testing commit 9178bf2 with merge 9334e4398c5fd844c76883d1c50b516c5656cc4b... |
jonas-schievink
commented
Jan 30, 2021
@bors r- retry |
rust-log-analyzer
commented
Jan 30, 2021
bors
commented
Feb 23, 2021
☔ The latest upstream changes (presumably #82076) made this pull request unmergeable. Please resolve the merge conflicts. |
petrochenkov
commented
Mar 11, 2021
The issue #80846 was closed so closing the PR as well. |
std::panic!()always expanded to a{..}block, butcore::panic!()did not. Because of this subtle difference, theissue-5500-1test passed forstd::panic!(), but not forcore::panic!().This makes them behave the same, and extends that test to also check core::panic!().
This fixes#80846.
This is part of the effort to make
std::panic!()andcore::panic!()identical, as tracked in #80162.