Closed
Description
I tried to compile crate syn (2.0.37/2.0.43/master) with -Znext-solver=globally
and got errors:
error[E0284]: type annotations needed: cannot satisfy `<std::result::Result<restriction::Visibility, error::Error> as std::ops::Try>::Residual == <std::result::Result<_, error::Error> as std::ops::Try>::Residual`
--> src/data.rs:166:56
|
166 | let _visibility: Visibility = input.parse()?;
| ^ cannot satisfy `<std::result::Result<restriction::Visibility, error::Error> as std::ops::Try>::Residual == <std::result::Result<_, error::Error> as s
td::ops::Try>::Residual`
This is short example to reproduce:
#![crate_type="lib"]
pub trait Trait: Sized {
fn foo(_: &S) -> Result<Self, ()>;
}
impl Trait for () {
fn foo(_: &S) -> Result<Self, ()> {
Ok(())
}
}
pub struct S;
impl S {
pub fn baz<T: Trait>(&self) -> Result<T, ()> {
T::foo(self)
}
pub fn call<T>(&self, f: fn(&S) -> Result<T, ()>) -> Result<T, ()> {
f(self)
}
}
fn bar(_: &S) -> Result<(), ()> {
Ok(())
}
pub fn test(s: &S) -> Result<(), ()> {
let _ = s.call(bar)?;
Ok(s.baz()?)
}
Meta
rustc --version --verbose
:
rustc 1.77.0-nightly (bf8716f1c 2023-12-24)
binary: rustc
commit-hash: bf8716f1cd6416266807706bcae0ecb2e51c9d4a
commit-date: 2023-12-24
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6