-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Incorrect / Inconsistent behavior of deref coercion with {} #23014
Comments
Whoah, |
Triage; no change. |
I came across this today while writing a macro. Until this bug gets fixed, if you're in a situation where you need deref coercion of &{ expr } to work correctly, a workaround is to add an extra &*&{ expr } which will then coerce correctly. |
Triage: issue still reproduces on 2021 edition, tested on |
Related or duplicate of #26978, apparently. |
Got bitten by this today with |
quoting @compiler-errors about the first example:
|
In this code, the commented-out lines fail to compile.
playpen
I believe that, among other things,
f(&{Box::new(Foo)});
should compile since&{Box::new(Foo)}
has type&Box<Foo>
, which is deref-coercible to&Foo
.Additionally, the behavior is so inconsistent that it is basically impossible to predict whether the other lines will compile without trying them.
The text was updated successfully, but these errors were encountered: