Skip to content
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

First attempt at fixing #20591 #24818

Merged
merged 6 commits into from
May 12, 2015
Merged

First attempt at fixing #20591 #24818

merged 6 commits into from
May 12, 2015

Conversation

tbelaire
Copy link
Contributor

This isn't quite right, but it's interesting.

This isn't quite right, but it's interesting.
@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@tbelaire
Copy link
Contributor Author

Oh, should have r? nrc since he was mentoring issue #20591

@alexcrichton
Copy link
Member

Yeah I'll transfer review to @nrc

r? @nrc

@rust-highfive rust-highfive assigned nrc and unassigned alexcrichton Apr 25, 2015
Still compiling, but I think I have it!
I don't this we need to print the definition of the
imported value too, though it's quite possible.
@tbelaire tbelaire changed the title WIP First attempt at fixing #20591 First attempt at fixing #20591 Apr 25, 2015
@nrc
Copy link
Member

nrc commented Apr 29, 2015

Hi @tbelaire, is this ready for review now? (I couldn't work out from the conversation, sorry).

@tbelaire
Copy link
Contributor Author

Yup, sorry, I was nattering a lot.
I has a [WIP] in front when I was still working on it.

TypeNS => "type",
ValueNS => "value",
},
use syntax::ast_map::NodeItem;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either use a qualified path for NodeItem, or move this import to the top of the file. Not really worth having it here

@tbelaire
Copy link
Contributor Author

tbelaire commented May 1, 2015

Alright, should be all fixed, I just finished recompiling and testing.

@tbelaire
Copy link
Contributor Author

@nrc This is ready to land, looks good?

@nrc
Copy link
Member

nrc commented May 12, 2015

@bors r+ db9d018

@nrc
Copy link
Member

nrc commented May 12, 2015

@tbelaire sorry it took a while - I was on vacation last week

@bors
Copy link
Contributor

bors commented May 12, 2015

⌛ Testing commit db9d018 with merge feac9f1...

bors added a commit that referenced this pull request May 12, 2015
This isn't quite right, but it's interesting.
span_err!(self.resolver.session, import_span, E0252, "{}", &msg[..]);
let use_id = import_resolution.id(namespace);
let item = self.resolver.ast_map.expect_item(use_id);
// item is syntax::ast::Item;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'd prefer a type annotation in code rather than in a comment.
(I won't block this PR on that nit; it's more a note for the future...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always feel so weirded out when just annotating the type is what forces an import. I went back and forth on that line, it felt strange to be the only line importing from syntax::map.

Just as a style note, I feel like it'd be easier to navigate the code if even more type annotations were placed, (or I had a IDE which could tell me the type on mouseover). But I'm sure the core team already knows the types of most of the functions, so it's unnecessary for them, and in fact, just extra noise.

Which way should I favour in general? I'm hesitant to break with the established style, but I feel it'd be helpful to the newer contributors to add a fair number of annotations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DXR, which should be coming online soon, does type on mouse-over for most variables.

I'd probably remove the comment and not add an annotation, tbh - I think a programmer should probably expect the result of expect_item to be an Item.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye, but what kind of item? syntax ::map isn't even imported.

I know I had to open up a number of files side by side and carefully trace through struct and function definitions to pin down some types in this block. A simple type annotation or two would have saved me at least 10 minutes of tracking things down.

@bors bors merged commit db9d018 into rust-lang:master May 12, 2015
barosl added a commit to barosl/rust that referenced this pull request May 26, 2015
Currently, for `use` declarations with multiple paths, only the `use`
item itself is saved in the AST map, not the individual path nodes. This
can lead to a problem when a span of a specific path node is needed.

For example, rust-lang#24818 caused an ICE because of this, in
`ImportResolver::check_for_conflicting_import()`.

Fixes rust-lang#25763.
barosl added a commit to barosl/rust that referenced this pull request May 26, 2015
Currently, for `use` declarations with multiple paths, only the `use`
item itself is saved in the AST map, not the individual path nodes. This
can lead to a problem when a span of a specific path node is needed.

For example, rust-lang#24818 caused an ICE because of this, in
`ImportResolver::check_for_conflicting_import()`.

Fixes rust-lang#25763.
bors added a commit that referenced this pull request May 27, 2015
Currently, for `use` declarations with multiple paths, only the `use` item itself is saved in the AST map, not the individual path nodes. This can lead to a problem when a span of a specific path node is needed.

For example, #24818 caused an ICE because of this, in `ImportResolver::check_for_conflicting_import()`.

Fixes #25763.
XMPPwocky pushed a commit to XMPPwocky/rust that referenced this pull request May 29, 2015
Currently, for `use` declarations with multiple paths, only the `use`
item itself is saved in the AST map, not the individual path nodes. This
can lead to a problem when a span of a specific path node is needed.

For example, rust-lang#24818 caused an ICE because of this, in
`ImportResolver::check_for_conflicting_import()`.

Fixes rust-lang#25763.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants