Skip to content

fix: into_iterator not completed on Vec<{unknown}> #10373

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

Merged
merged 2 commits into from
Sep 28, 2021

Conversation

iDawer
Copy link
Contributor

@iDawer iDawer commented Sep 27, 2021

Fixes #10297

@lnicola
Copy link
Member

lnicola commented Sep 27, 2021

Ah, I didn't manage to write a test here.

Should we do the same thing in autoderef?

@iDawer
Copy link
Contributor Author

iDawer commented Sep 27, 2021

Actually there are more: impls_future, impls_fnonce, impls_trait. Do we need tests for them? Let me see if there are trivial tests

@iDawer
Copy link
Contributor Author

iDawer commented Sep 27, 2021

I couldn't reproduce this in tests but RA definetely fails on it (hir::Type::autoderef fixed):

struct Foo<T>;
struct Bar;
trait Trait {
    fn quux(&self) {}
}
impl<T> core::ops::Deref for Foo<T> {
    type Target = Bar;
    fn deref(&self) -> &Self::Target;
}
impl Trait for Bar {}
fn main() {
    let x: Foo<_>;
    x.$0
    // missing `quux` method in completions
}

I had tried to fix impls_trait but Chalk started panicking on the next example. This needs some elaboration.

struct Vec<T>;
impl<T> IntoIterator for Vec<T> {
    type Item = ();
    type IntoIter = ();
    fn into_iter(self);
}
fn main() {
    let x: Vec<_>;
    x.$0;
    // missing postfix completion "for"
}

Leave this and others for next time?

@iDawer iDawer changed the title fix: replace errors in receiver type when iterating method candidates fix: into_iterator not completed on Vec<{unknown}> Sep 27, 2021
@iDawer iDawer force-pushed the completion.issue10297 branch from 417bbfb to a683b3b Compare September 27, 2021 19:56
Copy link
Member

@flodiebold flodiebold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors d+

@bors
Copy link
Contributor

bors bot commented Sep 28, 2021

✌️ iDawer can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@iDawer iDawer force-pushed the completion.issue10297 branch from a683b3b to f222665 Compare September 28, 2021 19:28
@iDawer
Copy link
Contributor Author

iDawer commented Sep 28, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Sep 28, 2021

@bors bors bot merged commit 629db28 into rust-lang:master Sep 28, 2021
@iDawer iDawer deleted the completion.issue10297 branch September 28, 2021 19:49
@iDawer
Copy link
Contributor Author

iDawer commented Sep 30, 2021

This PR caused regression in nightly #10396 (fixed by #10399)

bors bot added a commit that referenced this pull request Sep 30, 2021
10399: minor: don't drop binders when doing autoderef r=lnicola a=iDawer

This fixes #10396 panic introduced in #10373

Co-authored-by: Dawer <[email protected]>
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

Successfully merging this pull request may close these issues.

into_iterator not resolved or completed on Vec<{unknown}>
3 participants