Code Monkey home page Code Monkey logo

Comments (2)

xFrednet avatar xFrednet commented on May 20, 2024

I'll start looking into this issue slowly. For reference, Clippy has clippy_utils::def_path_res. The documentation notes, that a path like std::vec could resolve to the module and macro which is a good thing to keep in mind. I'm considering, if it might be good to restrict the resolve function to TyDefIds, as that should be the main usage of it anyways.

Further things found during research:


Notes about special cases, for extra fun:

  • Crates can depend on the same crate with different versions multiple times if they rename the dependency. The name resolution will need to handle this correctly... This will be fun....
  • Symbols can life in different Namespaces. This might be a problem for types, const/static variables and macros. I hope that they're all in the same namespace, but we have to test for that at some point. See Namespaces

from marker.

xFrednet avatar xFrednet commented on May 20, 2024

I'm sadly still stuck on this issue. It seems like rustc does all path resolution at once in an AST-pass. It makes sense for rustc not to expose a simple way to resolve paths outside of that, as additional usages would be a "code smell". However, this doesn't make it easy for external tools like Clippy and Marker. I see 4 ways to solve this and will need some more time to decide:

  1. Create a PR allowing external tools to use rustc's path resolution. Here IDK, which method would be enough to expose and also how to create the state the solver would need
  2. Use Clippy's manual path resolution
  3. Write a manual path resolution for Marker, similar to Clippy's
  4. Magically find a way to resolve paths with rustc that I've overlooked so far.

from marker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.