Generic size_of in array constructor


#1

I’ve got this sample code here: https://play.rust-lang.org/?gist=dd50814ceacb90d3d2198a0eef958453&version=nightly&mode=debug

Function g returns the size of a type T. f constructs an array with element type T and of length size of T. They both use size_of. g compiles. f doesn’t. What am I doing wrong?


#2

This is a known bug where trait bounds aren’t applied in that location: https://github.com/rust-lang/rust/issues/43408