Optimizing Rustc's next trait solver

60 points by jana a day ago on lobsters | 11 comments

Great article! I'm not a langdev or Rust expert by any means, but I have a question about this part:

Well, it turns out the where bound is implicit. T: Add really means T: Add + Sized, and so proving Sized works the same as proving Add.

So far I had been led to believe that T: Sized is implied for any <T>, not just when T: Add (in this case), and you have to manually opt out with T: ?Sized, so even a fn foo<T>() with no where implies T: Sized - am I misunderstanding something here?

[OP] jana | 6 hours ago

Nope! you're understanding it right. I guess it's not 100% clear from my explanation, but indeed Sized is default regardless of other bounds. My explanation refers to the specific example where there is an Add bound and that really means Add+Sized. If there wasn't an Add bound it'd have still implied T: Sized. And, you also got it right that ?Sized opts out of that behavior (or in the future T: MetaSized will be the new way to opt out).

Ah right, that makes sense, got it. Thanks!

[OP] jana | 6 hours ago

I added this explanation and your question to the blogpost itself, together with some references :)

kiwec | a day ago

You should optimize this website so that it displays text before the youtube video is fully loaded.

Lilian | a day ago

Fwiw it did exactly that on my phone repeatedly.

[OP] jana | 22 hours ago

I cannot replicate this, tried for awhile now. The entire page is only a few kilobytes, and there's some fonts, not much more. I self-host it in the Netherlands, possibly you're living closer to a youtube server than my house.

rileylabrecque | 21 hours ago

I seen probably what kiwec seen, from Seattle on Windows with both Firefox and Chrome.

https://i.imgur.com/R30VDhG.mp4

Not a problem worth really posting about though...

[OP] jana | 21 hours ago

Seattle does sound a hell of a lot closer to a YouTube server than my computer in Europe haha

ekuber | 19 hours ago

You could avoid the flash of white followed by text by instead having the text use a system font as fallback and then allow it to reflow once the CSS fonts loaded. It is not great, but it fails back more gracefully if the fonts never load.

Lilian | 16 hours ago

Sorry, to be clear, I meant that on my phone the text loads first. I live in California (SF bay area)