Rust: extract generic parameters, arguments and resolve bound type variables#19237
Rust: extract generic parameters, arguments and resolve bound type variables#19237
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR aims to support the extraction of generic parameters, arguments, and the resolution of bound type variables in Rust. It introduces two new generic structs (LocalKey and Thing) and implements a From trait conversion for Thing instantiated with type X.
Files not reviewed (3)
- rust/ql/lib/codeql/rust/elements/internal/LifetimeImpl.qll: Language not supported
- rust/ql/test/extractor-tests/crate_graph/modules.expected: Language not supported
- rust/ql/test/extractor-tests/crate_graph/modules.ql: Language not supported
Comments suppressed due to low confidence (2)
rust/ql/test/extractor-tests/crate_graph/module.rs:47
- [nitpick] The struct name 'LocalKey' is ambiguous; consider renaming it or adding a doc comment to clarify its purpose.
pub struct LocalKey<T: 'static> {
rust/ql/test/extractor-tests/crate_graph/module.rs:48
- [nitpick] Consider renaming the field 'inner' to a more descriptive name that reflects its functionality to improve code readability.
inner: fn(Option<&mut Option<T>>) -> *const T,
5c67429 to
df5f003
Compare
a2844cc to
77d8ae8
Compare
This reverts commit 260322b.
Enum variants cannot be declared as a module item, they can only be imported
77d8ae8 to
7bfd5f1
Compare
There was a problem hiding this comment.
I'll dive into it more in depth tomorrow, but a generic comment I have is that crate_graph.rs is growing even more in complexity, and as far as I can tell it's really using very unstable parts of rust-analyzer. In my rust-analyzer updates experiences, this is the code that has been breaking on every update and needs quite some effort to keep up to date (see the next update in the queue).
That said, is that something we can conceivably avoid? Is running some limited form of the regular generated extractor on dependency source out of the question because of performance? I'm starting to fear this code is creeping out of control a bit, and risks becoming the biggest maintenance burden of the whole extractor.
redsun82
left a comment
There was a problem hiding this comment.
Hoestly did not have a deep look at the new crate graph code, but we can work on that in the next days.
This PR aims to support the extraction of generic parameters, arguments, and the resolution of bound type variables in Rust.