Skip to content
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

Associated Functions defined with turbo fish cause unintended recursive call #6927

Open
bitzoic opened this issue Feb 12, 2025 · 0 comments
Open
Labels
bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged

Comments

@bitzoic
Copy link
Member

bitzoic commented Feb 12, 2025

When using the turbo fish syntax to define an associated function, if there is another function defined by the same name in the file the compiler will revert with an error stating there is a recursive call when there is none.

Example:

library;

pub struct MyStruct {
    val: u64
}

pub trait MyTrait<T> {
    fn foo() -> T;
}

impl MyTrait<u64> for MyStruct {
    fn foo() -> u64 {
        1
    }
}

// Unassociated function defined as foo()
fn foo() {
    <MyStruct as MyTrait<u64>>::foo();
}
Image

Tested with for v0.66.7

@bitzoic bitzoic added bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

No branches or pull requests

1 participant