-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
false positive implied_bounds_entailment lint #108544
Comments
🤦 I think this is due to us preferring param-env candidates for |
So the issue here is that We try to prove that in the hybrid param-env of the impl's WC + trait method's WC, being Due to some frustrating precedence rules around candidate assembly in the trait solver, we try to match That requires us to prove |
I wonder if we could get away with not checking |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
Been thinking about this a little bit. One thought I had was to check that the impl method is WF given only the trait method, but I think that would break this example: pub trait Trait<'a, 'b> {
fn method(self, _: &'static &'static ())
where
'a: 'b;
}
impl<'a> Trait<'a, 'static> for () {
fn method(self, _: &'static &'a ()) {}
}
This is annoying difficult, because it's not straightforward to get "just the implied lifetime bounds" of a type. I'm playing around with using |
The lint is triggered by the following code (from #108345, cc @EqualMa) :
In the environment
<'a> where Cow<'a, str>: Sized
, the typeOption<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
The text was updated successfully, but these errors were encountered: