-
Notifications
You must be signed in to change notification settings - Fork 553
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
Warning about Rust 2024 with the newest Nightly Compiler: this function depends on never type fallback being ()
#1228
Comments
I'm looking into this, but ATM I'm not sure how to solve this on the crate side. |
Hmm, just tried it again. I think this could basically be the following situation: #![feature(never_type)]
trait Constructible {
fn construct() -> Self;
}
impl Constructible for () {
fn construct() -> Self {
()
}
}
// impl Constructible for ! {
// fn construct() -> Self {
// loop {}
// }
// }
fn generic_return<T: Constructible>() -> Result<T, ()> {
Ok(T::construct())
}
fn main() -> Result<(), ()> {
generic_return()?;
Ok(())
} If I enable the implementation for |
https://discord.com/channels/273534239310479360/1253055949598363760 join the club 😅, I received explanations and I still don't fully grasp it. |
I don't think I have access via your link. Do I need to join a specific channel before I can read that? What I also noticed in my example is as soon as I replace the fn main() -> Result<(), ()> {
generic_return().unwrap();
Ok(())
} To me it feels like these two should be interchangeable without such different type inference. |
You need to join the Rust Programming Language server - https://discord.com/invite/rust-lang-community
No, because ? desugars to a match, see rust-lang/rust#51125 (comment) |
In my code I often use code that ignores the return value of operations like
set
:Now with the newest nightly compiler I get the following warning:
Now I don't entirely understand what's going on here, but this warning seems to be fixable for me like this:
This is just not very convenient nor pretty. Am I doing something wrong? Is there any way the
redis
crate can mute this warning?The text was updated successfully, but these errors were encountered: