Skip to content

Conversation

@redsun82
Copy link
Contributor

@redsun82 redsun82 commented Dec 5, 2024

First go at making canonical paths more semantic.

What works:

  • identity at the DB level of extracted canonical paths
  • distinguishing trait implementations for incompatible instantiations of the same generic type (which was broken until now)

What needs to be done:

  • caching of path extractions: currently state of the PR redoes the trap emission for every single path and every single prefix of the paths
  • adapt the QL library and queries to the new paths
  • removing old path extraction methods (currently they are there to let QL compile, but come out empty from the extractor, wreaking havoc in tests)

What might be broken without changing how we use rust-analyzer or upstreaming changes to it:

  • const parameters of types are not easily visible

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Dec 5, 2024
}

impl<T> GenericTrait<T> for GenericStruct<i32, T> {
fn generic_method(&self, t: T) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 'self' is not used.
}

impl<T> GenericTrait<T> for GenericStruct<i32, T> {
fn generic_method(&self, t: T) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 't' is not used.
}

impl GenericTrait<i32> for GenericStruct<&str, i32> {
fn generic_method(&self, t: i32) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 'self' is not used.
}

impl GenericTrait<i32> for GenericStruct<&str, i32> {
fn generic_method(&self, t: i32) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 't' is not used.
}

impl<T> GenericTrait<T> for GenericTupleStruct<i32, T> {
fn generic_method(&self, t: T) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 'self' is not used.
}

impl GenericTrait<i32> for GenericTupleStruct<&str, i32> {
fn generic_method(&self, t: i32) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 't' is not used.
}

impl<T> GenericTrait<T> for GenericEnum<i32, T> {
fn generic_method(&self, t: T) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 'self' is not used.
}

impl<T> GenericTrait<T> for GenericEnum<i32, T> {
fn generic_method(&self, t: T) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 't' is not used.
}

impl GenericTrait<i32> for GenericEnum<&str, i32> {
fn generic_method(&self, t: i32) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 'self' is not used.
}

impl GenericTrait<i32> for GenericEnum<&str, i32> {
fn generic_method(&self, t: i32) {}

Check notice

Code scanning / CodeQL

Unused variable Note test

Variable 't' is not used.
import codeql.rust.elements.canonical_paths.RustcCrateRoot
import codeql.rust.elements.canonical_paths.TypeCanonicalPath
import codeql.rust.elements.canonical_paths.TypeGenericArg
import codeql.rust.elements.canonical_paths.TypeGenericTypeArg

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.Addressable
.
Redundant import, the module is already imported inside
codeql.rust.elements.Resolvable
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ImplItemCanonicalPath
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ModuleItemCanonicalPath
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.Namespace
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.TypeCanonicalPath
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.TypeItemCanonicalPath
.
import codeql.rust.elements.canonical_paths.TypeCanonicalPath
import codeql.rust.elements.canonical_paths.TypeGenericArg
import codeql.rust.elements.canonical_paths.TypeGenericTypeArg
import codeql.rust.elements.canonical_paths.TypeItemCanonicalPath

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.CanonicalPath
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.CrateRoot
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.TypeGenericArg
.

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.LangCrateRoot
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.Namespace
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.RepoCrateRoot
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.RustcCrateRoot
.

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.TypeItemCanonicalPath
.

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ModuleItemCanonicalPath
.

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ConstGenericTypeArg
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.TypeGenericTypeArg
.
*/

private import internal.ImplItemCanonicalPathImpl
import codeql.rust.elements.canonical_paths.CanonicalPath

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath
.
Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.TypeCanonicalPath
.
*/

private import internal.ModuleItemCanonicalPathImpl
import codeql.rust.elements.canonical_paths.CanonicalPath

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.Namespace
.
*/

private import internal.ParametrizedCanonicalPathImpl
import codeql.rust.elements.canonical_paths.CanonicalPath

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ModuleItemCanonicalPath
.
*/

private import internal.TypeItemCanonicalPathImpl
import codeql.rust.elements.canonical_paths.CanonicalPath

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
codeql.rust.elements.canonical_paths.ModuleItemCanonicalPath
.
@redsun82 redsun82 closed this Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants