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

Should ast::Position use Symbol instead of str? #60795

Closed
oli-obk opened this issue May 13, 2019 · 4 comments · Fixed by #61568
Closed

Should ast::Position use Symbol instead of str? #60795

oli-obk opened this issue May 13, 2019 · 4 comments · Fixed by #61568
Assignees
Labels
A-parser Area: The parsing of Rust source code to an AST. C-cleanup Category: PRs that clean code up or issues documenting cleanup.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented May 13, 2019

ArgumentNamed(&'a str),
is compared against symbols in clippy, and I believe in rustc many uses could also be comparing against symbols. Is this something we should do @nnethercote ?

@oli-obk oli-obk added C-cleanup Category: PRs that clean code up or issues documenting cleanup. A-parser Area: The parsing of Rust source code to an AST. labels May 13, 2019
@nnethercote
Copy link
Contributor

Possibly. The best way to decide is to simply try it and see how well it works. Sometimes switching to a symbol makes everything fall out nicely. Sometimes there are a bunch of follow-on changes required but it still ends up nice. Sometimes it ends up making the code more complicated and a string is better.

@nnethercote
Copy link
Contributor

Hmm, libfmt_macros currently doesn't depend on any crates, and with this change it would depend on libsyntax_pos.

@oli-obk
Copy link
Contributor Author

oli-obk commented May 14, 2019

libfmt_macros also custom rolls its own Span type. Having a dependency on libsyntax_pos can possibly make a lot of things simpler, but I haven't checked in depth.

cc @estebank

@estebank
Copy link
Contributor

I believe that should likely be appropriate. CC me on the PRs to take a look at them.

@Mark-Simulacrum Mark-Simulacrum self-assigned this Jun 4, 2019
Centril added a commit to Centril/rust that referenced this issue Jun 12, 2019
…r=estebank

Use Symbol, Span in libfmt_macros

I'm not super happy with this, personally, but I think it might be a decent start -- happy to take suggestions as to how to expand this or change things further.

r? @estebank

Fixes rust-lang#60795
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST. C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants