Skip to content

nightly-2024-07-23: fix: allow calling a trait method with paths that don't consist of ex…

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 23 Jul 02:19
· 373 commits to master since this release
88c0a40
…actly two segments (#5577)

# Description

## Problem

Resolves #5557

## Summary

For something like `Add::add` the logic was checking if `Add` was a
trait, then looking for a method `add` in it. It only worked if the path
had exactly two segments.

I initially thought the fix was simple: also make it work if there are
more segments. However, it got tricky if there's just one segment: we
need to find out the trait associated with the found function. This
wasn't tracked in `FuncMeta` (well, there was a boolean for it but not
the optional `TraitId`) so in this PR this information is now tracked,
and the lookup works in all cases.

## Additional Context

None.

## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.