Change:
<ins> // check-pass pub fn foo<'a>(s: &'a mut ()) where &'a mut (): Clone { <&mut () as Clone>::clone(&s); } fn main() {} </ins>

Discussion:
On stable 1.45.2, and From of : Possible related or duplicate issues are (doesn't seem to be as general) and (currently marked as solved). <details<summary<strongBacktrace on stable 1.45.2</strong</summary<p</p</details<details<summary<strongBacktrace on 1.47.0-beta.1 (2020-08-25 )</strong</summary<p</p</details<details<summary<strongBacktrace on 1.47.0-nightly (2020-08-25 )</strong</summary<p</p</details
Note that the function doesn't need to be public. Also, after reading the docstring that this example came from, it seems like an attempt is made to generate code, although no code should be emitted (the function can never be called, as the where clause can not be satisfied).
This regressed in 1.44.0.
ping cleanup-crew This issue could use a bisection to nail down where it starts. I think it regressed in between 1.43..1.44
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good "Cleanup ICE-breaking candidate". In case it's useful, here are some [instructions] for tackling these sorts of bugs. Maybe take a look? Thanks! <3 [instructions]: https://rustc-dev- cc
Regression in searched nightlies: from nightly-2020-04-21 to nightly-2020-09-02 regressed nightly: nightly-2020-05-03 searched commits: from to regressed commit:
Assigning as and removing .
No longer ICEs since

UPDATED DESCRIPTION: We now allow the original problem, but some corner cases are still unhandled. See comments below. ORIGINAL DESCRIPTION: Where clauses right now require predicates to contain type parameters, as in: But we cannot add constraints on non-generic types: Will error out with: In hand written code this usually won't come up, but this would be really helpful for a code generator like or , especially when dealing with associated types. Currently the only way to know if a type is generic or not is to manually walk it and see if any of the type paths start with the same name as a type parameter. If so, add that type to the predicate list. Instead, it would be much simpler if we could just add all the types listed in a field or enum to the predicate list and let the type checker report an error if one of those types doesn't implement the trait. cc
So I think this is a good reason to just permit where clauses like this. Ideally we'll report errors at the callee, though it's easiest to report errors at the caller.
you seem to have disappeared from IRC, but the point about privacy is a good one -- I feel like the privacy rules are being too strict here.
I'm not so sure about the privacy thing any more. After some conversation with we felt like the current rules might be best.
Should this be closed as wontfix/intended, then?
I lost track of this, did anyone remove the check that ensures bound types include a type parameter? I remember we had talked about shuffling around some error reporting as well, but its been too many days since I've thought about this.
I think the privacy rules are somewhat orthogonal to allowing non-generic where clauses (although the motivating use case is definitely undermined by the current privacy rules).
Triage: this now works. Full reproduction:
Huh. When did that happen? I know there have been some pending PRs about this, but there were some thorny issues, and I didn't realize that we'd made any actual changes here. do you know?
What? I didn't implement this?
I think this is the relevant commit:
Yeah I was wondering if this was somehow fallout from that change. That's a bit unexpected though.

So we do need a solution that addresses this example raised by :+1: The key point in this example is that this where clause could never hold -- but because it's only parametric over a lifetime, we will try to trans it, and find that there is no existing impl. This could either fail in typeck -- but we'd have to search for impls using an erased parameter -- or else fail in trans -- where the absence of an impl could cause us to emit a trap or something like that, on the premise that the fn should not in fact be callable. Basically in trans we can just check if we know statically that the fn could never be called and generate a trap or what have you. Or just don't translate it. Or something. This seems similar to the logic that we use to screen things out of vtables.
triage: P-medium
triage: P-medium
triage: P-medium
P-low?
Triage: 's sample compiles, but if you try to use it, can never work. Aka, this is still an issue, as far as I can tell.
is a duplicate of 's example. That issue contains more recent diagnostics: the example no longer compiles.
The original issue now compiles with the trivial bounds feature, see