Skip to content

Predicate failure during translation of call to native returning generic type #1185

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

Closed
brson opened this issue Nov 17, 2011 · 2 comments
Closed
Labels
A-codegen Area: Code generation I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@brson
Copy link
Contributor

brson commented Nov 17, 2011

native mod m {
    fn cast<T>() -> T;
}

type t<T> = { t: T };

fn main() {
    let i: t<int> = m::cast();
}
rust: upcall fail 'Predicate type_has_static_size(ccx, ret_ty) failed', ../src/comp/middle/trans.rs:3851
rust: domain main @0x9745e38 root task failed
@nikomatsakis
Copy link
Contributor

Yes, there are some dubious checks in various places. I looked into fixing this. I believe the best way is to (a) use wrappers around native functions and (b) translate native functions with dynamically sized return values so that they use an initial pointer as the return type. This would fit well with the C convention of inserting silent structure arguments. We should probably do the same for structure return types to cdecl functions; LLVM would probably do it for us, but that will yield a second copy. Not sure how STDCALL functions handle this case.

@catamorphism
Copy link
Contributor

Obsolete. Checks were removed at some point IIRC, plus type_has_static_size doesn't seem to exist at all.

coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

3 participants