-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
This compiles:
fn main() {
let x = &5;
x = &std::panic!()
}This does not:
fn main() {
let x = &5;
x = &core::panic!()
}error[E0308]: mismatched types
--> src/main.rs:3:9
|
3 | x = &core::panic!()
| ^^^^^^^^^^^^^^^ expected integer, found `!`
|
= note: expected reference `&{integer}`
found reference `&!`
The cause seems to be that std::panic!() expands to { some_function(..) } while core::panic!() expands to some_function(..), without { .. }. Adding { .. } in the core::panic!() macro_rules 'fixes' it.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.