-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: Add "make tuple" tactic to term search #16687
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
Conversation
"0277" if generated.contains(&todo) => continue, // See https://github.com/rust-lang/rust/issues/69882 | ||
"0282" | "0283" => continue, // Byproduct of testing method | ||
"0277" | "0308" if generated.contains(&todo) => continue, // See https://github.com/rust-lang/rust/issues/69882 | ||
// FIXME: In some rare cases `AssocItem::container_or_implemented_trait` returns `None` for trait methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not sound good 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah 😛
It'happened once for FromStr::from_str
in ripgrep
crate. Got no idea how that case was special tho
@bors r+ |
☀️ Test successful - checks-actions |
Follow up to #16092
Now term search also supports tuples.
In addition to new tactic that handles tuples I changed how the generics are handled.
Previously it tried all possible options from types we had in scope but now it only tries useful ones that help us directly towards the goal or at least towards calling some other function.
This changes O(2^n) to O(n^2) where n is amount of rounds which in practice allows using types that take generics for multiple rounds (previously limited to 1). Average case that also used to be exponential is now roughly linear.
This means that deeply nested generics also work.
Note that although the complexity is smaller allowing more types with generics the search overall slows down considerably. I hope it's fine tho as the autocomplete is disabled by default and for code actions it's not super slow. Might have to tweak the depth hyper parameter tho
This resulted in a huge increase of results found (benchmarks on
ripgrep
crate):Before
After
Most changes are local to term search except some tuple related stuff on
hir::Type
.