Closed
Description
fn main() {
box (1 + 2) * 3;
// box (1.0 + 2.0).sqrt()
}
with just the first:
boxerror.rs:2:17: 2:20 error: type `<generic integer #2>` cannot be dereferenced
boxerror.rs:2 box (1 + 2) * 3;
^~~
boxerror.rs:2:5: 2:20 error: only the managed heap and exchange heap are currently supported
boxerror.rs:2 box (1 + 2) * 3;
^~~~~~~~~~~~~~~
with the second uncommented it's a parse error:
boxerror.rs:4:20: 4:21 error: unexpected token: `.`
boxerror.rs:4 box (1.0 + 2.0).sqrt()
^
The (...)
is interpreted as the allocator/placement part of the box
expression, rather than just part of the value to be boxed. It would be nice to suggest something like "if you wish to use the default box
write box () ...;
".
(Also, "amusingly", the code as written above hits #14084)