-
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
Add where
to borrowck_could_not_prove
#107881
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,15 @@ error: higher-ranked lifetime error | |
LL | v.t(|| {}); | ||
| ^^^^^^^^^^ | ||
| | ||
= note: could not prove `[closure@$DIR/issue-59311.rs:17:9: 17:11] well-formed` | ||
= note: could not prove `where [closure@$DIR/issue-59311.rs:17:9: 17:11] well-formed` | ||
|
||
error: higher-ranked lifetime error | ||
--> $DIR/issue-59311.rs:17:9 | ||
| | ||
LL | v.t(|| {}); | ||
| ^^^^^ | ||
| | ||
= note: could not prove `for<'a> &'a V: 'static` | ||
= note: could not prove `where for<'a> &'a V: 'static` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesn't seem consistent with other diagnostics that print predicates in error messages There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe "could not prove the where-clause There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it's a case that was, I guess, written off as too "simple" to test for here that causes the most problem, where it is a fairly down-the-line "could not prove No The problem is that by the time you've read all the way up to the That's why I think it's important to use Because what they're actually going to be dealing with is seeing, out-of-context: I don't think this is enough, but the "actual fix" would be to simply rework how predicates are expressed in diagnostics (basically to the point of never surfacing them unadorned) because a little colon is not really cutting it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, first of all I didn't mean to suggest that Secondly, I guess we get away with this for regular trait errors:
By formatting the " But later in a label, we format it like " Maybe we should just special-case the presentation of trait (and projection) predicates here. Shouldn't be too hard to split them up across their Not sure if that effort is worth it, though? "higher-ranked lifetime error"s are kinda the kitchen sink of NLL errors, and hitting them a lot suggests maybe some other error reporting path should be refactored to give a holistically better error message for them. I'd be happy to do that quick change of special-casing the presentation of just trait/projection predicates if you don't want to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine! I just wanted to be clear because the case that can arise isn't in the tests. Or, well, at least why it's crummy isn't shown in the tests. Right. Reiteration and phrasing it two different ways helps a lot. I actually agree that special-casing it is the proper solution. Yeah, it's a "kitchen sink" error, but even the worst possible error should be... acceptable? Like it's gonna be trash, but it should be okay trash. I'd like to take a look at that refactoring actually, it just required more than "blink once" as effort. |
||
|
||
error: aborting due to 2 previous errors | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is strange, though more of a side-effect of us not having surface syntax for WF goals