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

Redesign the libsyntax and librustc APIs to make them more amenable to tooling #9769

Closed
bstrie opened this issue Oct 8, 2013 · 3 comments
Closed
Labels
P-low Low priority

Comments

@bstrie
Copy link
Contributor

bstrie commented Oct 8, 2013

http://www.reddit.com/r/programming/comments/1nxs2i/the_state_of_rust_08/ccn50ti

I hope they can also innovate in the area of code navigation and code completion as well. It's not perfect in the C++ IDE world, and if you use something like Emacs of Vim it's even worse.

With the work in Rustdoc, and integration with LLVM, and the fact that Rust is orders of magnitude easier to parse than C++, IDE support shouldn't be a problem. What does need to be implemented is incremental compilation.

To get properly useful semantic code completion, libsyntax and librustc would need to be dramatically overhauled to get partial parsing working and to make it easier/possible to extract information like "what's the type of this variable" and "what methods can I call on this [mutable] variable."

There's long been sentiment that the APIs provided by libsyntax and librustc are kinda okay for tooling, but not great.

For another anecdote, this past weekend at MozSummit someone asked whether it would be possible to add Rust support to DXR (http://dxr.mozilla.org/), to which Graydon replied that it would be difficult (relative to clang, at least).

This is obviously sort of a nebulous "figure out the API" bug, but it's important enough that we'll have to start thinking about it sometime. Without a good tooling story, we won't be able to compete with C++.

@bstrie
Copy link
Contributor Author

bstrie commented Oct 8, 2013

Nominating for Production Ready milestone.

@nrc
Copy link
Member

nrc commented Jan 22, 2014

Heh, that was me that asked Graydon about DXR :-) DXR support is coming along nicely, but we hack an extra phase into the compiler rather than using a nice API. Hopefully we can do better in the long run...

@steveklabnik
Copy link
Member

I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.

This issue has been moved to the RFCs repo: rust-lang/rfcs#643

flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 1, 2022
Add new lint  [`misnamed-getters`]

```
changelog: Add new lint  [`misnamed-getters`]
```

Closes rust-lang#9769

The current lint matches all methods with a body of just one expression under the form `(&mut?)? <expr>.field` where field doesn't match the name of the method but there is a field of the same type in `<expr>` that matches the name. This allows matching nested structs, for example for newtype wrappers. This may cast the net a bit too wide and cause false positives. I'll run [clippy_lint_tester](https://github.com/mikerite/clippy_lint_tester) on the top crates to see how frequently false positives happen.

There also may be room for improvement by checking that the replacement field would work taking into account implementations of `Deref` and `DerefMut` even if the types don't exactly match but I don't know yet how this could be done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-low Low priority
Projects
None yet
Development

No branches or pull requests

3 participants