false positive implied_bounds_entailment lint · Issue #108544 · rust-lang/rust (original) (raw)
The lint is triggered by the following code (from #108345, cc @EqualMa) :
use std::borrow::Cow;
pub trait Trait { fn method(self) -> Option<Cow<'static, str>> where Self: Sized; }
impl<'a> Trait for Cow<'a, str> { fn method(self) -> Option<Cow<'static, str>> { None } }
In the environment <'a> where Cow<'a, str>: Sized
, the type Option<Cow<'static, str>>
surprisingly requires 'a == 'static
for well-formedness (see #108345 (comment)), but this constraint is not used in implied bounds, so I believe it can't be exploited for unsoundness.
The lint was upgraded to deny-by-default in the current beta (1.68.0-beta.5 2023-02-15 003b6f2). So this counts as regression?
cc @compiler-errors.
@rustbot label C-bug T-types T-compiler regression-from-stable-to-beta