Skip to content

Rust: Unify type inference for tuple indexing expressions #20182

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rust: Remove comment from type inference test
  • Loading branch information
hvitved committed Aug 7, 2025
commit e172e7435766e3c0b21347af12e584518e48924c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
multipleCallTargets
| dereference.rs:61:15:61:24 | e1.deref() |
| main.rs:2314:13:2314:31 | ...::from(...) |
| main.rs:2315:13:2315:31 | ...::from(...) |
| main.rs:2308:13:2308:31 | ...::from(...) |
| main.rs:2309:13:2309:31 | ...::from(...) |
| main.rs:2310:13:2310:31 | ...::from(...) |
| main.rs:2316:13:2316:31 | ...::from(...) |
| main.rs:2322:13:2322:31 | ...::from(...) |
| main.rs:2323:13:2323:31 | ...::from(...) |
| main.rs:2324:13:2324:31 | ...::from(...) |
| main.rs:2317:13:2317:31 | ...::from(...) |
| main.rs:2318:13:2318:31 | ...::from(...) |
6 changes: 0 additions & 6 deletions rust/ql/test/library-tests/type-inference/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2068,12 +2068,6 @@ mod indexers {
}

fn analyze_slice(slice: &[S]) {
// NOTE: `slice` gets the spurious type `[]` because the desugaring of
// the index expression adds an implicit borrow. `&slice` has the type
// `&&[S]`, but the `index` methods takes a `&[S]`, so Rust adds an
// implicit dereference. We cannot currently handle a position that is
// both implicitly dereferenced and implicitly borrowed, so the extra
// type sneaks in.
let x = slice[0].foo(); // $ target=foo type=x:S target=index
}

Expand Down
Loading
Loading