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

todo!() does not prevent errors in functions returning impl Trait #122005

Closed
JamieH01 opened this issue Mar 4, 2024 · 1 comment
Closed

todo!() does not prevent errors in functions returning impl Trait #122005

JamieH01 opened this issue Mar 4, 2024 · 1 comment

Comments

@JamieH01
Copy link

JamieH01 commented Mar 4, 2024

return position impl Trait is not coerced from !, leading to the following code to error:

trait MyTrait {}

fn my_function() -> impl MyTrait {
    todo!()
}

this code currently reports "the trait MyTrait is not implemented for ()". note that this code does work:

trait MyTrait {}

fn my_function<T: MyTrait>() -> T {
    todo!()
}
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 4, 2024
@JamieH01
Copy link
Author

JamieH01 commented Mar 4, 2024

this issue already exists, and i didnt find that at first. sorry!

@JamieH01 JamieH01 closed this as completed Mar 4, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants