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
{{ message }}
Repository navigation
bounds on trait impls are used in implied bounds #109628
traitTrait{typeAssoc;}impl<T:'static>TraitforBox<T>{typeAssoc = ();}structMyTy<U>(U)whereU:Trait,U::Assoc:Sized,// any predicate naming U::Assoc;fnfn_test<T>(_:MyTy<Box<T>>){}
fn_test should fail with an error requiring an explicit T: 'static bound.
This is a compiler bug for the following reasons:
It certainly does not follow from the rules of RFC 1214 and RFC 2089. The implied bounds from a trait reference (Box<T>: Trait) includes only the where-clauses of the trait itself, not the trait impl.
It breaks stability guarantees in the sense that relaxing region constraints on trait impls is now a breaking change. Removing the useless bound U::Assoc: Sized is also a breaking change.
It requires remote reasoning when dealing with implied bounds.
It is a surprising behavior: why does the trivial bound U::Assoc: Sized make any meaningful difference?
Activity
tolerate region vars in implied bounds
Auto merge of rust-lang#112422 - aliemjay:implied-bounds-placeholders…
jackh726 commentedon Nov 29, 2023
Just for reference: This is a stable-to-stable regression, first passing in 1.29.0.
🤷♀️ on adding the label
Auto merge of rust-lang#118553 - jackh726:lint-implied-bounds, r=lcnr
lcnr commentedon Jan 19, 2024
this still applies to
bevyand during MIR typeck due to #119956, reopening.