implied bounds from impl header are not used in associated functions/consts · Issue #98852 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
The following fails to compile although it shouldn't: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f7287b6897a385360f7190001b58348d
/// A type with an implied bound 'b: 'a
struct Ty<'a, 'b>(&'a &'b ());
impl<'a, 'b> Ty<'a, 'b> // <- tait or inherent impl
where
//'b: 'a, // <- fixed by an explicit bound
{
fn f() { // <- no Self
in signature
Self;
//~^ ERROR lifetime bound not satisfied
// Cannot prove WF of Self
because 'b: 'a
is not known to hold
}
}
Another repro:
struct Ty<'a, 'b>(&'a &'b ());
impl<'a, 'b> Ty<'a, 'b>{ fn f() { None::<&'a &'b ()>; //~^ ERROR lifetime bound not satisfied } }
The first repro regressed in 1.43 while the second one is as old as implied bounds.
@rustbot label A-implied-bounds A-associated-items regression-from-stable-to-stable T-types
Meta
Nightly version: 1.64.0-nightly
(2022-07-01 46b8c23)
Backtrace