You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now, to be fair, I do remember that I had to start adding the trait Sized with the appropriate lang item when using #![no_std] at some point. And that was okay, because I got a message telling me to do so (or at least, a message saying it was missing, which is close enough).
But this seems to go a step further and somehow remove the implicit Sized-ness from generic type parameters? (Or have I overlooked some obvious goof in the code above?)
#![feature(lang_items)]#![no_std]#![crate_type="lib"]#[lang="sized"]pubtraitSized{}pubfnfoo<T>(b:bool,x:T, f: |T| -> int) -> int{if b {f(x)}else{3}}
And it now compiles.
So okay -- maybe we just need to improve the error reporting for the original case to check if the Sized lang item is defined, and if not, include a note to the user that they may want to add it.
The text was updated successfully, but these errors were encountered:
Transcript of something that I saw today that I thought was odd:
Now, to be fair, I do remember that I had to start adding the
trait Sized
with the appropriate lang item when using#![no_std]
at some point. And that was okay, because I got a message telling me to do so (or at least, a message saying it was missing, which is close enough).But this seems to go a step further and somehow remove the implicit Sized-ness from generic type parameters? (Or have I overlooked some obvious goof in the code above?)
At @cmr's suggestion, I changed the code to this:
And it now compiles.
So okay -- maybe we just need to improve the error reporting for the original case to check if the
Sized
lang item is defined, and if not, include a note to the user that they may want to add it.The text was updated successfully, but these errors were encountered: