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

Support extern opaque types. #595

Closed
crlf0710 opened this issue Aug 18, 2020 · 5 comments · Fixed by #601
Closed

Support extern opaque types. #595

crlf0710 opened this issue Aug 18, 2020 · 5 comments · Fixed by #601
Assignees

Comments

@crlf0710
Copy link
Member

#![feature(extern_types)]

extern "C" {
    type A;
    fn foo() -> Box<A>;
    fn bar();
}

impl A {
    fn bar(&self) {
        unsafe {bar()};
    }
}

fn main() {
    let a = unsafe { foo() } ;
    a.bar();
}

This code compiles fine in rustc, but rust-analyzer gives Box<{unknown}> inlay hint to a.

@jackh726
Copy link
Member

While not technically "built-in", I think this falls under #368, so I'm gonna link this there.

Overall, I think this should be pretty easy. I think we really only need to add an extra variant to TypeName. Other than that, we won't add any clauses for Sized/Copy/Clone traits.

@memoryleak47
Copy link
Contributor

I'll try this one.

@jackh726
Copy link
Member

jackh726 commented Sep 4, 2020

@rustbot assign @memoryleak47

@jackh726
Copy link
Member

jackh726 commented Sep 4, 2020

Ah right, I can't do that.

@crlf0710
Copy link
Member Author

crlf0710 commented Sep 4, 2020

Thanks! Hopefully this will help solve rust-lang/rust-analyzer#4150 .

@bors bors closed this as completed in caa7ab5 Sep 4, 2020
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 a pull request may close this issue.

3 participants