Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upEmit data::Impl in save-analysis #47657
Conversation
rust-highfive
assigned
nikomatsakis
Jan 22, 2018
This comment has been minimized.
This comment has been minimized.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
|
It's specifically @nrc that needs to look at this PR to guide me in completing the work. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
r? @nrc |
rust-highfive
assigned
nrc
and unassigned
nikomatsakis
Jan 22, 2018
This comment has been minimized.
This comment has been minimized.
|
Thanks @jonhoo I was aware of the feature but unsure whether it applied to wip stuff. |
carols10cents
added
the
S-waiting-on-review
label
Jan 22, 2018
This comment has been minimized.
This comment has been minimized.
|
Ping from triage, @nrc! |
nrc
reviewed
Jan 29, 2018
| @@ -1088,6 +1139,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>( | |||
| analysis, | |||
| span_utils: SpanUtils::new(&tcx.sess), | |||
| config: find_config(config), | |||
| impl_counter: Cell::new(0_u32), | |||
This comment has been minimized.
This comment has been minimized.
| self.dumper.dump_relation(impl_data); | ||
| if let super::Data::RelationData(rel, imp) = impl_data { | ||
| self.dumper.dump_relation(rel); | ||
| self.dumper.dump_impl(imp); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
algesten
Jan 29, 2018
Author
Contributor
@nrc but the cast macro is written for super::Data enclosing one value. Since this is the only data emitting two values, I though it cleaner make this an exeption rather than changing the macro to handle a tuple as well.
This comment has been minimized.
This comment has been minimized.
| kind: kind, | ||
| span: span, | ||
| value: String::new(), // ??? | ||
| parent: None, // ??? enclosing module? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
algesten
Jan 29, 2018
Author
Contributor
@nrc sorry I feel stupid here. can I actually get the parent module? All other match arms of ast::ImplKind set parent: None. Is this case different?
| id: impl_id, | ||
| kind: kind, | ||
| span: span, | ||
| value: String::new(), // ??? |
This comment has been minimized.
This comment has been minimized.
| .collect(), | ||
| docs: "".to_string(), // ??? trait docs? | ||
| sig: None, // ??? trait sig? | ||
| attributes: vec![], // ??? trait attrs? |
This comment has been minimized.
This comment has been minimized.
nrc
Jan 29, 2018
Member
There might be attributes on the impl that should be recorded here (I think). We don't need anything else. For docs and sig, we can leave them as they are (though I would prefer to use only one way to make an empty string).
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
algesten
Jan 29, 2018
Author
Contributor
@nrc Unless I'm looking in the wrong place, there doesn't seem to be any attrs on the Impl level (there are on the ImplItem level).
https://manishearth.github.io/rust-internals-docs/syntax/ast/enum.ItemKind.html
| let hash = hasher.finish(); | ||
|
|
||
| // is this a good idea? | ||
| (hash ^ hash << 32) as u32 |
This comment has been minimized.
This comment has been minimized.
nrc
Jan 29, 2018
Member
You can just use the 64 bit hash - iirc, we use 32 bits for a local id (NodeId) and 64 for a global id (DefId)
This comment has been minimized.
This comment has been minimized.
|
So, having thought this through a little bit, I think the hashing scheme might be overkill (sorry). We could just use the count of impls as the id, as long as clients ensure that impl ids are in a separate namespace from other ids, then I think everything will be OK (and that should be OK, since impl ids and def ids are not interchangeable). |
This comment has been minimized.
This comment has been minimized.
|
Ok. I remove the hashing. |
This comment has been minimized.
This comment has been minimized.
|
OK, this all looks. I've merged your changes to rls-data and released that as version 0.15. Could you also squash your commits please? |
This comment has been minimized.
This comment has been minimized.
|
Here's the new output. It looks ok. {
"impls": [
{
"id": 0,
"kind": "Direct",
"span": {
"file_name": [
115,
114,
99,
47,
109,
97,
105,
110,
46,
114,
115
],
"byte_start": 234,
"byte_end": 242,
"line_start": 15,
"line_end": 15,
"column_start": 22,
"column_end": 30
},
"value": "",
"parent": null,
"children": [
{
"krate": 0,
"index": 22
},
{
"krate": 0,
"index": 24
}
],
"docs": "",
"sig": null,
"attributes": []
}
]
} |
algesten
force-pushed the
algesten:save-analysis-impls
branch
from
8f033f1
to
c7709fd
Feb 1, 2018
This comment has been minimized.
This comment has been minimized.
|
@nrc I've updated to rls-data 0.15 and squashed the commits. |
This comment has been minimized.
This comment has been minimized.
|
Hm. maybe i rebase.. |
algesten
force-pushed the
algesten:save-analysis-impls
branch
from
c7709fd
to
93d3ebc
Feb 1, 2018
This comment has been minimized.
This comment has been minimized.
|
I think you don't want to change the submodules which are included in this PR? But you probably do need to build (and maybe update) in order to get rls-data 0.15 into the Cargo.lock |
This comment has been minimized.
This comment has been minimized.
|
Oh. I check. |
algesten
force-pushed the
algesten:save-analysis-impls
branch
from
93d3ebc
to
38c517c
Feb 2, 2018
This comment has been minimized.
This comment has been minimized.
|
@nrc sorted. submodule free and one Cargo.lock. |
This comment has been minimized.
This comment has been minimized.
|
and rebased off master again. |
This comment has been minimized.
This comment has been minimized.
|
Thanks! @bors: r+ |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@nrc do i rebase off master again? |
This comment has been minimized.
This comment has been minimized.
|
@algesten Yes please rebase. Also, remove the |
bors
added
the
S-waiting-on-author
label
Feb 7, 2018
This comment has been minimized.
This comment has been minimized.
|
Why this PR is always merge-conflicting (Please rebase again) |
algesten
force-pushed the
algesten:save-analysis-impls
branch
from
f70dddd
to
9a6afa8
Feb 10, 2018
This comment has been minimized.
This comment has been minimized.
|
Done |
This comment has been minimized.
This comment has been minimized.
|
@bors r=nrc |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
S-waiting-on-bors
and removed
S-waiting-on-author
labels
Feb 10, 2018
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Feb 10, 2018
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
S-waiting-on-review
and removed
S-waiting-on-bors
labels
Feb 10, 2018
This comment has been minimized.
This comment has been minimized.
bors
added
S-waiting-on-bors
and removed
S-waiting-on-review
labels
Feb 10, 2018
kennytm
referenced this pull request
Feb 10, 2018
Closed
Spurious (?) error in "compile-fail\rfc-2126-extern-in-paths\single-segment.rs" etc #48116
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Feb 11, 2018
This comment has been minimized.
This comment has been minimized.
|
|
bors
merged commit 9a6afa8
into
rust-lang:master
Feb 11, 2018
kennytm-githubbot
added a commit
to rust-lang-nursery/rust-toolstate
that referenced
this pull request
Feb 11, 2018
This was referenced Feb 11, 2018
This comment has been minimized.
This comment has been minimized.
|
@nrc @algesten FYI the
|
This comment has been minimized.
This comment has been minimized.
|
@kennytm this is expected (I think) and should be solved by updating the RLS and then updating the version in the Repo |
algesten commentedJan 22, 2018
•
edited
As discussed on internals.rust-lang, this PR emits
rls-data::Implin the save-analysis.A number of questions are outstanding:
???around row 356. We need to discuss what goes here, if anything.Derivingidfor impl using hashing. Is this going to clash with rustc defids?Derivingidfor impl using hashing. Is the conversion from 64 bit -> 32 bit problematic?idfield inImplstruct.Need a new rls-data whichderiveHashforImplKindenum.