3

Make sure to insert `Sized` bound first into clauses list by compiler-errors · P...

 2 weeks ago
source link: https://github.com/rust-lang/rust/pull/123302
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation

Member

#120323 made it so that we don't insert an implicit Sized bound whenever we see an explicit Sized bound. However, since the code that inserts implicit sized bounds puts the bound as the first in the list, that means that it had the side-effect of possibly meaning we check Sized after checking other trait bounds.

If those trait bounds result in ambiguity or overflow or something, it may change how we winnow candidates. (edit: SEE #123303) This is likely the cause for the regression in #123279 (comment), since the impl...

impl<T: Job + Sized> AsJob for T { // <----- changing this to `Sized + Job` or just `Job` (which turns into `Sized + Job`) will FIX the issue.
}

...looks incredibly suspicious.

Fixes [after beta-backport] #123279.

Alternative is to revert #120323. I don't have a strong opinion about this, but think it may be nice to keep the diagnostic changes around.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK