-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Closed
Copy link
Labels
P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
The following code (playground link) results in a method resolution error on the second call to x.method()
. It compiles successfully if x.method()
is called only once:
trait Foo {
fn method(&self) {}
}
struct Wrapper<T>(T);
impl<T> Foo for Wrapper<T> where for<'a> &'a T: IntoIterator<Item=&'a ()> {}
fn f(x: Wrapper<Vec<()>>) {
x.method(); // This works.
x.method(); // error: no method named `method`
}
The error is:
error: no method named `method` found for type `Wrapper<std::vec::Vec<()>>` in the current scope
--> <anon>:11:7
|
11 | x.method(); // error: no method named `method`
| ^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `method`, perhaps you need to implement it:
= help: candidate #1: `Foo`
@jonas-schievink suggested this might be a bug in the projection cache or some other cache.
This is a regression from Rust 1.10.0-stable to 1.11.0-stable.
Metadata
Metadata
Assignees
Labels
P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.