Skip to content
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

Investigate why Autoref doesn't work with Minicore/Tests #16685

Closed
davidbarsky opened this issue Feb 26, 2024 · 3 comments
Closed

Investigate why Autoref doesn't work with Minicore/Tests #16685

davidbarsky opened this issue Feb 26, 2024 · 3 comments

Comments

@davidbarsky
Copy link
Contributor

  • impl ForeignTrait for LocalStruct and impl ForeignTrait for &LocalStruct provide completions on let t = &TestStruct in both tests and a running binary.
  • impl ForeignTrait for &LocalStruct only provides completions for provide completions on let t = TestStruct in a running binary.
    • This makes me think that there's a bug in minicore—or that I might not be understanding some important details—because this behavioral split reproduces with and without my filtering changes.

Originally posted by @davidbarsky in #16555 (comment)

@HKalbasi
Copy link
Member

Doesn't adding more minicore flags help? Maybe minicore: deref is not enough? Supporting minicore: * could help in these situations.

@Veykril
Copy link
Member

Veykril commented Feb 27, 2024

Hmm, actually that test can't work can it? Autoref only applies at most once, but for the call to be valid in that example we need to have a double reference, once for the receiver and once for the impl self type. So if we start from a TestStruct receiver we will only walk up to &TestStruct which is still not a valid callee for the impl

impl foo::TestTrait for &TestStruct {
    fn some_method(&self) {}
}

as that needs a receiver of &&TestStruct

@davidbarsky
Copy link
Contributor Author

Oh, I think you're right: I think the lack of syntax highlighting in the fixture blinded me to the fact that even without my changes in #16555, the following does not get completions for some_method.

struct TestStruct;

impl crate_b::TestTrait for &TestStruct {
    fn some_method(&self) {}
}

#[test]
fn test() {
    let t = TestStruct;
    t.$0
}

There's no bug in minicore.

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

No branches or pull requests

3 participants