-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Generalized article_and_description #67742
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☔ The latest upstream changes (presumably #67476) made this pull request unmergeable. Please resolve the merge conflicts. |
@matthewjasper Thanks! I have pushed my progress so far. Please let me know what you think. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@matthewjasper What should I do about EDIT: actually, that file already appears to be |
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☔ The latest upstream changes (presumably #68725) made this pull request unmergeable. Please resolve the merge conflicts. |
ddb84fc
to
7a6361f
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Tests passing now. The UI changes are all "function" -> "method". |
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author |
@@ -7,7 +7,7 @@ LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | |||
| lifetime `'a` defined here | |||
LL | | |||
LL | if x > y { x } else { y } | |||
| ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` | |||
| ^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` |
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.
Hmm... actually, this is not a method... all the others appear correct.
And I also just realized, that I don't know why this change in UI happened? Any ideas?
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.
The change causing this is here: /~https://github.com/rust-lang/rust/pull/67742/files#diff-5f616dd3631e07b51dd7c59f32ccfb76R433
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.
Hmm... do you mean this one instead?
Also, this seems to imply that we are getting a DefKind::Method
instead of a DefKind::Fn
. Is this expected?
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.
DefKind::Method
is for all associated functions. This is generally what Method
means in the compiler, not that it should be leaking into error messages.
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.
We should rename DefKind::Method
to DefKind::AssocFn
so that it fits with the scheme used for AssocTy
, AssocConst
, etc. cc @petrochenkov @eddyb
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.
Pretty sure we have an issue open about this, yeah.
r=me if you're happy with the current use of "method" in the diagnostics. |
@matthewjasper Thanks! This looks good to me. If there is an easy way to fix it, perhaps I can do that in a followup? |
I was thinking of changing what @bors r+ |
📌 Commit 9434d6b has been approved by |
☀️ Test successful - checks-azure |
let kind = self.def_kind(def_id).unwrap(); | ||
(kind.article(), kind.descr(def_id)) |
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.
I wish I saw this earlier - I think you should always call def_kind
and only look at the def_key
or other things if def_kind
returned None
.
The reason is that DefKind
should eventually encompass every possible DefId
, and the current situation is a transitional one (since DefKind
was split out of name resolution, which only needs the current set of possible DefKind
s).
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.
I don't know if there is an issue for finishing DefKind
, but feel free to work on that, or open one if there isn't one already.
Ideally def_key
would be used in as few places as possible, as it's really the "name" of a definition more than anything else.
…sper Change "method" to "associated function" r? @matthewjasper cc @Centril @eddyb rust-lang#67742 I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it... The relevant changes are the last two commits (it is rebased on top of rust-lang#67742)
…sper Change "method" to "associated function" r? @matthewjasper cc @Centril @eddyb rust-lang#67742 I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it... The relevant changes are the last two commits (it is rebased on top of rust-lang#67742)
…sper Change "method" to "associated function" r? @matthewjasper cc @Centril @eddyb rust-lang#67742 I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it... The relevant changes are the last two commits (it is rebased on top of rust-lang#67742)
r? @matthewjasper
The logic of finding the right word and article to print seems to be repeated elsewhere... this is an experimental method to unify this logic...