-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Broken method resolution for arc-swap + diesel #127306
Comments
Minimized reproduction: trait Requirement {}
trait Extension {
fn foo(self, x: i32)
where
Self: Requirement;
}
impl<T> Extension for T {
fn foo(self)
where
Self: Requirement,
{
}
}
struct Thing;
impl Thing {
fn foo(&self) {} // Note: &self, not self
}
fn what(x: Thing) {
x.foo()
} Error output
This happens because, when resolving the method call, rust checks calling the method on This can be worked around by using the disambiguated function call syntax, e.g. |
I tried this code:
I expected to see this happen: Code compiles without error as
ArcSwap::load()
existsInstead, this happened: Code fails to compile with the following error:
The method provided by diesel does clearly not apply as:
Meta
rustc --version --verbose
:(Although the same behavior can be observed with the latest nightly compiler)
Backtrace
The text was updated successfully, but these errors were encountered: