Unable to pass hook to panic::set_hook as a variable or without specifying type #84296
Labels
A-lifetimes
Area: Lifetimes / regions
C-discussion
Category: Discussion or questions that doesn't represent real issues.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
I tried this code:
I expected it to compile successfully.
Instead, this happened:
If I however not assign the
Box
to a variable and instead directly pass it topanic::set_hook
, it compiles:I believe it should be allowed to assign it to a variable beforehand.
That, or if you explicitly specify the type, it compiles too:
I believe it should be able to infer the type on its own.
Meta
rustc --version --verbose
:Note that on beta and nightly the error is different.
The text was updated successfully, but these errors were encountered: